public Node(Node parent, float cost, StratusWorldState state, StatefulAction action) { Parent = parent; Cost = cost; State = state; Action = action; }
private void OnEnable() { StatefulAction = target as StatefulAction; //BlackboardAsset = serializedObject.FindProperty("BlackboardAsset"); Type = serializedObject.FindProperty("Type"); Preconditions = serializedObject.FindProperty("Preconditions"); Effects = serializedObject.FindProperty("Effects"); Cost = serializedObject.FindProperty("Cost"); }
//------------------------------------------------------------------------/ // Methods //------------------------------------------------------------------------/ /// <summary> /// Executes the next action in the current plan /// </summary> public void ContinuePlan() { // If there's nothing actions left in the plan, reassess? if (CurrentPlan.IsFinished) { this.Goal.Complete(this); this.Agent.gameObject.Dispatch<Plan.ExecutedEvent>(new Plan.ExecutedEvent()); //if (Tracing) Trace.Script("The plan for " + this.CurrentGoal.Name + " has been fulfilled!", this); //this.gameObject.Dispatch<Agent.> return; } this.CurrentAction = CurrentPlan.Next(); this.CurrentAction.Initialize(this.Agent); }
/// <summary> /// Adds an action to the plan /// </summary> /// <param name="action"></param> public void Add(StatefulAction action) { Actions.AddLast(action); }