Exemple #1
0
void CAI_Rat::UpdateCL			()
{

	///////////////////////////////////////////////////////////////////////////////////////
#ifdef _DEBUG
	if (monster_squad().get_squad(this)->GetLeader() == this) {

		if (m_walk_on_way && m_path) draw_way();

	}
#endif
	///////////////////////////////////////////////////////////////////////////////////////

	if (!m_pPhysicsShell && !g_Alive())
		CreateSkeleton			();

	if (!Useful()) {
		inherited::UpdateCL		();
		Exec_Look				(Device.fTimeDelta);

		CMonsterSquad *squad	= monster_squad().get_squad(this);

		if (squad && 
			((squad->GetLeader() != this && !squad->GetLeader()->g_Alive()) ||
			squad->get_index(this) == u32(-1))
			) squad->SetLeader(this);

		if (squad &&
			squad->SquadActive() &&
			squad->GetLeader() == this &&
			m_squad_count != squad->squad_alife_count()
			) 
		{
			squad->set_rat_squad_index(squad->GetLeader());
			m_squad_count = squad->squad_alife_count();
		}
	}
	else {
		if (!H_Parent() && m_pPhysicsShell && m_pPhysicsShell->isActive())
			m_pPhysicsShell->InterpolateGlobalTransform(&XFORM());

		CPhysicsShellHolder::UpdateCL	();
		CEatableItem::UpdateCL			();
	}
}