Show StateFactory.cpp syntax highlighted
/**
**************************************************************************************
*Palisma - Secrets of the Illuminati is an open-source 2D RPG *
*Copyright (C) 2006, Tony Sparks *
* *
*This library is free software; you can redistribute it and/or *
*modify it under the terms of the GNU Lesser General Public *
*License as published by the Free Software Foundation; either *
*version 2.1 of the License, or (at your option) any later version. *
* *
*This library is distributed in the hope that it will be useful, *
*but WITHOUT ANY WARRANTY; without even the implied warranty of *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
*Lesser General Public License for more details. *
* *
*You should have received a copy of the GNU Lesser General Public *
*License along with this library; if not, write to the Free Software *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
**************************************************************************************
*/
#include "StdAfx.h"
#include "StateFactory.h"
#include "EntityStates.h"
StateFactory::StateFactory(void)
{
}
StateFactory::~StateFactory(void)
{
}
// our single instance
StateFactory* StateFactory::instance = new StateFactory;
/** Create a state */
State* StateFactory::CreateState( const std::string &s )
{
if (s == "WALKING")
{
return new WalkState;
}
else if ( s== "TALKING")
{
return new TalkState;
}
else if ( s== "ATTACKING1")
{
return new AttackState;
}
else if ( s=="ATTACKING2")
{
}
else if ( s== "ATTACKING3")
{
}
else if ( s=="IDLE")
{
return new IdleState;
}
else if( s=="RUNNING")
{
}
else if ( s== "GRABBING" )
{
}
else if ( s == "THROWING" )
{
return new ThrowingState;
}
else if ( s == "THROWN" )
{
return new ThrownState;
}
else if ( s== "DYING")
{
}
else if ( s== "HIT" )
{
return new HitState;
}
else if ( s== "CARRYING" )
{
return new CarryingState;
}
else if ( s== "CARRIED" )
{
return new CarriedState;
}
// else if ( s== "CARRYING_IDLE" )
//{
// return new CarryingIdleState;
//}
else if ( s== "CARRYING_WALKING" )
{
return new CarryingWalkingState;
}
else if ( s== "DEAD")
{
return new DeadState;
}
/*--------------------------------------
Weapon States
---------------------------------------*/
else if ( s == "WP_READY" )
{
return new ReadyState;
}
else if ( s == "WP_FIRING" )
{
return new FiringState;
}
else if ( s == "WP_RELOADING" )
{
return new ReloadingState;
}
return NULL;
}
See more files for this project here