📄 npcstatefactory.cpp
字号:
#include "StdAfx.h"
#include "NPCStateFactory.h"
#include "WanderState.h"
#include "PatrolState.h"
#include "IdleState.h"
#include "TrackState.h"
#include "AttackState.h"
#include "DeadState.h"
#include "HelpState.h"
#include "ThrustState.h"
#include "FlyingState.h"
#include "KnockDownState.h"
#include "JumpState.h"
#include "FallApartState.h"
#include "ReturnState.h"
#include "RetreatState.h"
#include "RunAwayState.h"
#include "ChaosState.h"
#include "SummonIdle.h"
#include "SpawnIdleState.h"
#include "StopIdleState.h"
#include "TrackAreaState.h"
NPCStateFactory::NPCStateFactory()
{
m_pWanderState = new WanderState; m_pIdleState = new IdleState;
m_pTrackState = new TrackState; m_pAttackState = new AttackState;
m_pHelpState = new HelpState; m_pThrustState = new ThrustState;
m_pDeadState = new DeadState; m_pFlyingState = new FlyingState;
m_pKnockDownState = new KnockDownState; m_pJumpState = new JumpState;
m_pFallApartState = new FallApartState; m_pReturnState = new ReturnState;
m_pRetreatState = new RetreatState; m_pRunAwayState = new RunAwayState;
m_pChaosState = new ChaosState; m_pSummonIdleState = new SummonIdle;
m_pPatrolState = new PatrolState; m_pSpawnIdleState = new SpawnIdleState;
m_pStopIdleState = new StopIdleState; m_pTrackAreaState = new TrackAreaState;
}
NPCStateFactory::~NPCStateFactory()
{
SAFE_DELETE( m_pWanderState ); SAFE_DELETE( m_pIdleState );
SAFE_DELETE( m_pTrackState ); SAFE_DELETE( m_pAttackState );
SAFE_DELETE( m_pHelpState ); SAFE_DELETE( m_pThrustState );
SAFE_DELETE( m_pDeadState ); SAFE_DELETE( m_pFlyingState );
SAFE_DELETE( m_pKnockDownState ); SAFE_DELETE( m_pJumpState );
SAFE_DELETE( m_pFallApartState ); SAFE_DELETE( m_pReturnState );
SAFE_DELETE( m_pRetreatState ); SAFE_DELETE( m_pRunAwayState );
SAFE_DELETE( m_pChaosState ); SAFE_DELETE( m_pSummonIdleState );
SAFE_DELETE( m_pPatrolState ); SAFE_DELETE( m_pSpawnIdleState );
SAFE_DELETE( m_pStopIdleState ); SAFE_DELETE( m_pTrackAreaState );
}
State *NPCStateFactory::Alloc( DWORD dwStateID )
{
State * pState = NULL;
switch( dwStateID )
{
case STATE_ID_WANDER:
pState = m_pWanderState; break;
case STATE_ID_IDLE:
pState = m_pIdleState; break;
case STATE_ID_TRACK:
pState = m_pTrackState; break;
case STATE_ID_ATTACK:
pState = m_pAttackState; break;
case STATE_ID_HELP:
pState = m_pHelpState; break;
case STATE_ID_THRUST:
pState = m_pThrustState; break;
case STATE_ID_DEAD:
pState = m_pDeadState; break;
case STATE_ID_FLYING:
pState = m_pFlyingState; break;
case STATE_ID_KNOCKDOWN:
pState = m_pKnockDownState; break;
case STATE_ID_JUMP:
pState = m_pJumpState; break;
case STATE_ID_FALL_APART:
pState = m_pFallApartState; break;
case STATE_ID_RETURN:
pState = m_pReturnState; break;
case STATE_ID_RETREAT:
pState = m_pRetreatState; break;
case STATE_ID_RUNAWAY:
pState = m_pRunAwayState; break;
case STATE_ID_CHAOS:
pState = m_pChaosState; break;
case STATE_ID_SUMMON_IDLE:
pState = m_pSummonIdleState; break;
case STATE_ID_PATROL:
pState = m_pPatrolState; break;
case STATE_ID_SPAWN_IDLE:
pState = m_pSpawnIdleState; break;
case STATE_ID_STOP_IDLE:
pState = m_pStopIdleState; break;
case STATE_ID_TRACK_AREA:
pState = m_pTrackAreaState; break;
default:
pState = m_pWanderState;
}
return pState;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -