Esempio n. 1
0
void ActionListControl::DoAction() {

	while ((ActionList.size() > 0) && 
		(Press_A_To_Con == false) && 
		(NextAct <= SDL_GetTicks())) {
		CAction tempAction = ActionList.front();        //Assign first action in list to temp action.	
			
		if (tempAction.Type == ACTION_TYPE_ATTACK) {     //If the action is an attack action...	
			
			AttackAction();								//call attack action function
			
			if (tempAction.fPATC == true) {				//CHeck Press A To Continue Flag
				Press_A_To_Con = true;
			}
			
			if (tempAction.fLOCK == true) {				//check fLock flag
				fLocked = true;
			}

			NextAct = (tempAction.Duration + SDL_GetTicks()); //make sure you lock the next action until this one is complete, 0 = concurrency
			ActionList.pop_front();						//Then kill the action
			LastAct = SDL_GetTicks();				//Log the time when it happened
				
		} else if (tempAction.Type == ACTION_TYPE_MOVE) {
			MoveAction();
			if (tempAction.fPATC == true) {				//CHeck Press A To Continue Flag
				Press_A_To_Con = true;
			}
			if (tempAction.fLOCK == true) {				//check fLock flag
				fLocked = true;
			}

			NextAct = (tempAction.Duration + SDL_GetTicks()); //make sure you lock the next action until this one is complete, 0 = concurrency
			ActionList.pop_front();						//Then kill the action
			LastAct = SDL_GetTicks();				//Log the time when it happened
				
		} else if (tempAction.Type == ACTION_TYPE_MESSAGE) {
			MessageAction();
			if (tempAction.fPATC == true) {				//CHeck Press A To Continue Flag
				Press_A_To_Con = true;
			}
			if (tempAction.fLOCK == true) {				//check fLock flag
				fLocked = true;
			}

			NextAct = (tempAction.Duration + SDL_GetTicks()); //make sure you lock the next action until this one is complete, 0 = concurrency
			ActionList.pop_front();						//Then kill the action
			LastAct = SDL_GetTicks();				//Log the time when it happened
				
		}

	}
}
Esempio n. 2
0
void NPC::TaskEnemy(void)
{
	if (FNullEnt(m_enemy))
		return;

	m_destOrigin = GetEntityOrigin (m_enemy);
	m_lookAt = m_destOrigin;

	DeleteSearchNodes();
	m_goalWaypoint = -1;

	m_moveSpeed = pev->maxspeed;
	AttackAction(m_enemy);
}