Exemplo n.º 1
0
status_t
RuleRunner::RunAction(const BMessage &action, entry_ref &ref)
{
	BString actionname;
	if (action.FindString("name",&actionname) != B_OK)
	{
		debugger("Couldn't find action name in RuleRunner::RunAction");
		return B_ERROR;
	}
	
	if (actionname.Compare("Move it to…") == 0)
		return MoveAction(action,ref);
	else if (actionname.Compare("Copy it to…") == 0)
		return CopyAction(action,ref);
	else if (actionname.Compare("Rename it to…") == 0)
		return RenameAction(action,ref);
	else if (actionname.Compare("Open it") == 0)
		return OpenAction(action,ref);
	else if (actionname.Compare("Add it to the archive…") == 0)
		return ArchiveAction(action,ref);
	else if (actionname.Compare("Terminal command…") == 0)
		return CommandAction(action,ref);
	else if (actionname.Compare("Move it to the Trash") == 0)
		return TrashAction(action,ref);
	else if (actionname.Compare("Delete it") == 0)
		return DeleteAction(action,ref);
	
	return B_ERROR;
}
Exemplo n.º 2
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
				
		}

	}
}
Exemplo n.º 3
0
void NPC::NPCAi(void)
{
	m_frameInterval = gpGlobals->time - m_lastThinkTime;
	m_lastThinkTime = gpGlobals->time;

	m_nextThinkTime = gpGlobals->time + 0.1f;

	g_npcAS = ASC_IDLE;
	m_moveSpeed = 0.0f;
	m_destOrigin = nullvec;
		
	FindWaypoint();

	FindEnemy();
	if (m_task & TASK_ENEMY)
		TaskEnemy();
	else if (m_task & TASK_MOVETOTARGET)
		TaskMoveTarget();
	else
		TaskBase();

	if (m_destOrigin == nullvec && m_currentWaypointIndex != -1)
	{
		m_destOrigin = m_waypointOrigin;
		m_lookAt = m_destOrigin;
		m_moveSpeed = pev->maxspeed;
	}

	if (m_iDamage)
	{
		m_changeActionTime = -1.0f;
		g_npcAS |= ASC_DAMAGE;
		m_iDamage = false;
	}

	FacePosition();
	MoveAction();

	ChangeAnim();
	pev->nextthink = m_nextThinkTime;
}
Exemplo n.º 4
0
void ActionList::MoveActionDown(const IAction* pAction)
{
	_ASSERTE(CanMoveActionDown(pAction));
	MoveAction(pAction, false);
}
Exemplo n.º 5
0
void ActionList::MoveActionUp(const IAction* pAction)
{
	_ASSERTE(CanMoveActionUp(pAction));
	MoveAction(pAction, true);
}
Exemplo n.º 6
0
 MoveAction move(double x, double y, double time) {
     return MoveAction().move(x, y, time);
 }