private void CompleteAction() { Debug.Log(gameObject.name + " completed action: " + currentAction.actionName); currentAction.running = false; currentAction.PostPerform(); invoked = false; }
void LateUpdate() { if (mCurrentAction != null && mCurrentAction.Running) { mCurrentAction.Perform(); if (!mCurrentAction.Running) { mCurrentAction.PostPerform(); mCurrentAction = null; } else { return; } } if (mPlanner == null || mActionQueue == null) { mPlanner = new GPlanner(); var sortedGoals = from entry in mGoals orderby entry.Value descending select entry; foreach (KeyValuePair <GAgentSubGoal, int> sg in sortedGoals) { mActionQueue = mPlanner.Plan(mActions, sg.Key.SubGoals, Beliefs); if (mActionQueue != null) { mCurrentGoal = sg.Key; break; } } } if (mActionQueue != null && mActionQueue.Count == 0) { if (mCurrentGoal.Remove) { mGoals.Remove(mCurrentGoal); } mPlanner = null; } if (mActionQueue != null && mActionQueue.Count > 0) { GAction newAction = mActionQueue.Dequeue(); //if (newAction != currentAction) // { mCurrentAction = newAction; if (!mCurrentAction.PrePerform()) { mActionQueue = null; } // } } }
//an invoked method to allow an agent to be performing a task //for a set location public void CompleteAction() { currentAction.running = false; if (currentAction.wp != null) { currentAction.wp = currentAction.wp.nextWaypoint; } currentAction.PostPerform(); invoked = false; }
void CompleteAction() { currentAction.running = false; currentAction.PostPerform(); invoked = false; }
void CompleteAction() { CurrentAction.Running = false; CurrentAction.PostPerform(); _invoked = false; }