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; }
/** * 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); }
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; } }; }
public void removeAction(GoapBaseAction action) { availableActions.Remove(action); }
public void addAction(GoapBaseAction a) { availableActions.Add(a); }
public static string prettyPrint(GoapBaseAction action) { String s = "" + action.GetType().Name; return(s); }