Exemple #1
0
 public Node(Node parent, float runningCost, HashSet <KeyValuePair <string, object> > state, GoapBaseAction action)
 {
     this.parent      = parent;
     this.runningCost = runningCost;
     this.state       = state;
     this.action      = action;
 }
Exemple #2
0
    /**
     * Create a subset of the actions excluding the removeMe one. Creates a new set.
     */
    private HashSet <GoapBaseAction> actionSubset(HashSet <GoapBaseAction> actions, GoapBaseAction removeMe)
    {
        HashSet <GoapBaseAction> subset = new HashSet <GoapBaseAction>();

        foreach (GoapBaseAction a in actions)
        {
            if (!a.Equals(removeMe))
            {
                subset.Add(a);
            }
        }
        return(subset);
    }
Exemple #3
0
    private void createMoveToState()
    {
        moveToState = (fsm, gameObj) => {
            // move the game object

            GoapBaseAction action = currentActions.Peek();
            if (action.requiresInRange() && action.target == null)
            {
                Debug.Log("<color=red>Fatal error:</color> Action requires a target but has none. Planning failed. You did not assign the target in your Action.checkProceduralPrecondition()");
                fsm.popState(); // move
                fsm.popState(); // perform
                fsm.pushState(idleState);
                return;
            }
        };
    }
Exemple #4
0
 public void removeAction(GoapBaseAction action)
 {
     availableActions.Remove(action);
 }
Exemple #5
0
 public void addAction(GoapBaseAction a)
 {
     availableActions.Add(a);
 }
Exemple #6
0
    public static string prettyPrint(GoapBaseAction action)
    {
        String s = "" + action.GetType().Name;

        return(s);
    }