示例#1
0
void ZBehavior::Init(ZBrain* pBrain)
{
	m_pBrain = pBrain;

	ZState* pState = new ZBehavior_Idle(pBrain);
	pState->AddTransition(ZBEHAVIOR_INPUT_ATTACKED,		ZBEHAVIOR_STATE_ATTACK);
	m_FSM.AddState(pState);

	pState = new ZBehavior_Attack(pBrain);
	m_FSM.AddState(pState);

	
	// ±âº»Àº idle
	ForceState(ZBEHAVIOR_STATE_IDLE);
}
示例#2
0
void ZBehavior::Init(ZBrain* pBrain)
{
	if ( !pBrain)
		return;

	m_pBrain = pBrain;

	ZState* pState = new ZBehavior_Idle(pBrain);
	pState->AddTransition(ZBEHAVIOR_INPUT_ATTACKED,		ZBEHAVIOR_STATE_ATTACK);
	m_FSM.AddState(pState);

	pState = new ZBehavior_Attack(pBrain);
	m_FSM.AddState(pState);

	
	m_nOffecseType	= (ZOFFENSETYPE)pBrain->GetBody()->GetNPCInfo()->nOffenseType;
	m_bFriendly		= pBrain->GetBody()->GetNPCInfo()->bFriendly;
}
示例#3
0
void ZActorAnimation::InitAnimationStates()
{
	ZState* pState;

	pState = m_AniFSM.CreateState( ZA_ANIM_NONE);
	pState->AddTransition(ZA_INPUT_WALK,			ZA_ANIM_WALK);
	pState->AddTransition(ZA_INPUT_RUN,				ZA_ANIM_RUN);
	pState->AddTransition(ZA_INPUT_ROTATE,			ZA_ANIM_WALK);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_RANGE_DAMAGED,	ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED1,	ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED2,	ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_EVENT_LIGHTNING_DAMAGED,ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_EVENT_STANDUP,			ZC_ANIM_STAND);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_IDLE);
	pState->AddTransition(ZA_INPUT_WALK,			ZA_ANIM_WALK);
	pState->AddTransition(ZA_INPUT_RUN,				ZA_ANIM_RUN);
	pState->AddTransition(ZA_INPUT_ROTATE,			ZA_ANIM_WALK);
	pState->AddTransition(ZA_INPUT_ATTACK_MELEE,	ZA_ANIM_ATTACK_MELEE);
	pState->AddTransition(ZA_INPUT_ATTACK_RANGE,	ZA_ANIM_ATTACK_RANGE);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_RANGE_DAMAGED,	ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED1,	ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED2,	ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_EVENT_LIGHTNING_DAMAGED,ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);
	pState->AddTransition(ZA_EVENT_SPECIAL1,		ZA_ANIM_SPECIAL1);
	pState->AddTransition(ZA_EVENT_SPECIAL2,		ZA_ANIM_SPECIAL2);
	pState->AddTransition(ZA_EVENT_SPECIAL3,		ZA_ANIM_SPECIAL3);
	pState->AddTransition(ZA_EVENT_SPECIAL4,		ZA_ANIM_SPECIAL4);
	pState->AddTransition(ZA_EVENT_NEGLECT1,		ZA_ANIM_NEGLECT1);
	pState->AddTransition(ZA_EVENT_NEGLECT2,		ZA_ANIM_NEGLECT2);


	pState = m_AniFSM.CreateState(ZA_ANIM_WALK);
	pState->AddTransition(ZA_INPUT_RUN,				ZA_ANIM_RUN);
	pState->AddTransition(ZA_EVENT_REACH_GROUND,	ZA_ANIM_WALK);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);
	pState->AddTransition(ZA_INPUT_ATTACK_MELEE,	ZA_ANIM_ATTACK_MELEE);
	pState->AddTransition(ZA_INPUT_ATTACK_RANGE,	ZA_ANIM_ATTACK_RANGE);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_RANGE_DAMAGED,	ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED1,	ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED2,	ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_EVENT_LIGHTNING_DAMAGED,ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);
	pState->AddTransition(ZA_INPUT_WALK_DONE,		ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_SPECIAL1,		ZA_ANIM_SPECIAL1);
	pState->AddTransition(ZA_EVENT_SPECIAL2,		ZA_ANIM_SPECIAL2);
	pState->AddTransition(ZA_EVENT_SPECIAL3,		ZA_ANIM_SPECIAL3);
	pState->AddTransition(ZA_EVENT_SPECIAL4,		ZA_ANIM_SPECIAL4);
	pState->AddTransition(ZA_EVENT_NEGLECT1,		ZA_ANIM_NEGLECT1);
	pState->AddTransition(ZA_EVENT_NEGLECT2,		ZA_ANIM_NEGLECT2);


	pState = m_AniFSM.CreateState(ZA_ANIM_RUN);
	pState->AddTransition(ZA_INPUT_RUN,				ZA_ANIM_RUN);
	pState->AddTransition(ZA_EVENT_REACH_GROUND,	ZA_ANIM_RUN);
	pState->AddTransition(ZA_INPUT_ATTACK_MELEE,	ZA_ANIM_ATTACK_MELEE);
	pState->AddTransition(ZA_INPUT_ATTACK_RANGE,	ZA_ANIM_ATTACK_RANGE);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_RANGE_DAMAGED,	ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED1,	ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED2,	ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_EVENT_LIGHTNING_DAMAGED,ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);
	pState->AddTransition(ZA_INPUT_WALK_DONE,		ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_SPECIAL1,		ZA_ANIM_SPECIAL1);
	pState->AddTransition(ZA_EVENT_SPECIAL2,		ZA_ANIM_SPECIAL2);
	pState->AddTransition(ZA_EVENT_SPECIAL3,		ZA_ANIM_SPECIAL3);
	pState->AddTransition(ZA_EVENT_SPECIAL4,		ZA_ANIM_SPECIAL4);
	pState->AddTransition(ZA_EVENT_NEGLECT1,		ZA_ANIM_NEGLECT1);
	pState->AddTransition(ZA_EVENT_NEGLECT2,		ZA_ANIM_NEGLECT2);


	pState = m_AniFSM.CreateState(ZA_ANIM_ATTACK_MELEE);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_RANGE_DAMAGED,	ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED1,	ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED2,	ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_EVENT_LIGHTNING_DAMAGED,ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_ATTACK_RANGE);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_RANGE_DAMAGED,	ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED1,	ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED2,	ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_EVENT_LIGHTNING_DAMAGED,ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
//	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
//	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);

	////////////////////////////////////////////////////////////////////////

	pState = m_AniFSM.CreateState(ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_REACH_PEAK,		ZA_ANIM_BLAST_FALL);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_BLAST_FALL);
	pState->AddTransition(ZA_EVENT_REACH_GROUND,	ZA_ANIM_BLAST_DROP);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_BLAST_DROP);
	pState->AddTransition(ZA_EVENT_STANDUP,			ZC_ANIM_STAND);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);

	////////////////////////////////////////////////////////////////////////

	pState = m_AniFSM.CreateState(ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_REACH_GROUND_DAGGER,	ZA_ANIM_BLAST_DAGGER_DROP);
	pState->AddTransition(ZA_EVENT_REACH_GROUND,	ZA_ANIM_BLAST_DAGGER_DROP);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_BLAST_DAGGER_DROP);
	pState->AddTransition(ZA_EVENT_STANDUP,			ZC_ANIM_STAND);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);

	
	pState = m_AniFSM.CreateState(ZA_ANIM_DIE);

	
	pState = m_AniFSM.CreateState(ZC_ANIM_STAND);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_SPECIAL1);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_RANGE_DAMAGED,	ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED1,	ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED2,	ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_EVENT_LIGHTNING_DAMAGED,ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_SPECIAL2);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_RANGE_DAMAGED,	ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED1,	ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED2,	ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_EVENT_LIGHTNING_DAMAGED,ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_NEGLECT1);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_RANGE_DAMAGED,	ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED1,	ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED2,	ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_EVENT_LIGHTNING_DAMAGED,ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);


	pState = m_AniFSM.CreateState(ZA_ANIM_NEGLECT2);
	pState->AddTransition(ZA_ANIM_DONE,				ZA_ANIM_IDLE);
	pState->AddTransition(ZA_EVENT_RANGE_DAMAGED,	ZA_ANIM_RANGE_DAMAGED);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED1,	ZA_ANIM_MELEE_DAMAGED1);
	pState->AddTransition(ZA_EVENT_MELEE_DAMAGED2,	ZA_ANIM_MELEE_DAMAGED2);
	pState->AddTransition(ZA_EVENT_LIGHTNING_DAMAGED,ZA_ANIM_LIGHTNING_DAMAGED);
	pState->AddTransition(ZA_EVENT_BLAST,			ZA_ANIM_BLAST);
	pState->AddTransition(ZA_EVENT_BLAST_DAGGER,	ZA_ANIM_BLAST_DAGGER);
	pState->AddTransition(ZA_EVENT_DEATH,			ZA_ANIM_DIE);
}