?? goal_hitswitch.cpp
字號:
Goal_HitSwitch::Goal_HitSwitch(AI* pAI, const PathNode *switchNode_) : Goal( pAI ), GoalQueue()
switchNode(switchNode_), timer(0.0f), active(false)
{
Assert(switchNode->flags & CPathNode::flagNodeSwitch);
const CEntity *pEntity = switchNode->GetEntity();
pSwitch = pEntity->Switch();
Assert(pSwitch);
}
bool Goal_HitSwitch::ReplanSubgoals(){
ResetSubgoals();
NewSubgoal(new Goal_GotoNode(mpAI, switchNode)); //goto the switch
NewSubgoal(new Goal_TurnToEntity(mpAI, pSwitch)); //turn towards the switch
return true;
}
Goal_HitSwitch::~Goal_HitSwitch()
{
}
// Update the goal
void Goal_HitSwitch::Update( float secs_elapsed )
{
if (!active){
ReplanSubgoals();
active = true;
}
typeGoalStatus status = UpdateSubgoals( secs_elapsed );
if (status==statusFailed) {
mGoalStatus = statusFailed;
return;
}
if (!NoSubgoals())
return;
mpAI->Nudge(pSwitch->ID()); //send an activation message to the switch
mGoalStatus = statusSucceeded;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -