Exemple #1
0
 // Constructor
 public Node(Node parent, float cost, Dictionary <string, int> allStates, GoalAction action)
 {
     this.parent = parent;
     this.cost   = cost;
     this.state  = new Dictionary <string, int>(allStates);
     this.action = action;
 }
        public static void doDone(GoalAction actionObject)
        {
            LogicEvent.fire2Rendering("onBallGoal", actionObject.team, actionObject.door, actionObject.objectID);
            LogicEvent.fire2Lua("onGoal", actionObject.door == Location.kLeftDoor);
            var scene = SceneViews.instance.getCurFBScene();

            scene.recordingAnimatorState = false;
            scene.setActorsAnimatorController(true);
        }
Exemple #3
0
        public bool CreateGoalAction(GoalAction instance)
        {
            if (instance.Id != 0)
            {
                return(false);
            }

            Db.GoalActions.Add(instance);
            Db.SaveChanges();
            return(true);
        }
Exemple #4
0
        public bool RemoveGoalAction(int idGoalAction)
        {
            GoalAction instance = Db.GoalActions.Find(idGoalAction);

            if (instance == null)
            {
                return(false);
            }

            Db.GoalActions.Remove(instance);
            Db.SaveChanges();
            return(true);
        }
Exemple #5
0
    //remove and action from a list of actions
    private List <GoalAction> ActionSubset(List <GoalAction> actions, GoalAction removeMe)
    {
        List <GoalAction> subset = new List <GoalAction>();

        foreach (GoalAction a in actions)
        {
            if (!a.Equals(removeMe))
            {
                subset.Add(a);
            }
        }
        return(subset);
    }
Exemple #6
0
        public bool UpdateGoalAction(GoalAction instance)
        {
            GoalAction cache = Db.GoalActions.Find(instance.Id);

            if (cache == null)
            {
                return(false);
            }

            //TODO : Update fields for GoalAction
            Db.Entry(instance).State = EntityState.Modified;
            Db.SaveChanges();
            return(true);
        }
Exemple #7
0
        // Overloaded Constructor
        public Node(Node parent, float cost, Dictionary <string, int> allStates, Dictionary <string, int> beliefStates, GoalAction action)
        {
            this.parent = parent;
            this.cost   = cost;
            this.state  = new Dictionary <string, int>(allStates);

            //as well as the world states add the agents beliefs as states that can be
            //used to match preconditions
            foreach (KeyValuePair <string, int> b in beliefStates)
            {
                if (!this.state.ContainsKey(b.Key))
                {
                    this.state.Add(b.Key, b.Value);
                }
            }
            this.action = action;
        }