Ejemplo n.º 1
0
 private FSMState GetGoalState(FSMState.FSMStates goalState) {
     foreach (FSMState state in states) {
         if (state.Type == goalState)
             return state;
     }
     return null;
 }
Ejemplo n.º 2
0
 public void ChangeState(AI_RTS_MonoGame.AI.FSM.FSMState.FSMStates state, bool reenter = false) {
     if (reenter || state != currentState.Type)
     {
         currentState.Exit();
         currentState = GetGoalState(state);
         currentState.Enter();
     }
 }
Ejemplo n.º 3
0
 public void Reset() {
     if (currentState != null)
         currentState.Exit();
     currentState = defaultState;
     foreach (FSMState state in states)
         state.Init();
     if (currentState != null)
         currentState.Enter();
 }
Ejemplo n.º 4
0
        public void Update(GameTime gameTime) {
            if (currentState == null)
                currentState = defaultState;
            if (currentState == null)
                return;

            FSMState.FSMStates goalType = currentState.CheckTransitions();
            ChangeState(goalType);
            currentState.Update(gameTime);
        }
Ejemplo n.º 5
0
 public void SetDefaultState(FSMState state)
 {
     defaultState = state;
 }
Ejemplo n.º 6
0
 public void AddState(FSMState state)
 {
     states.Add(state);
 }
Ejemplo n.º 7
0
 public UnitFSMState(FSMState.FSMStates type, UnitController controller, GameplayManager gm)
     : base(type)
 {
     this.controller = controller;
     this.gm = gm;
 }
Ejemplo n.º 8
0
 public UnitFSMState(FSMState.FSMStates type, UnitController controller) :base (type){
     this.controller = controller;
 }
Ejemplo n.º 9
0
 public void SetDefaultState(FSMState state) {
     defaultState = state;
 }
Ejemplo n.º 10
0
 public void AddState(FSMState state) {
     states.Add(state);
 }