Пример #1
0
 private FSMState GetGoalState(FSMState.FSMStates goalState) {
     foreach (FSMState state in states) {
         if (state.Type == goalState)
             return state;
     }
     return null;
 }
Пример #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();
     }
 }
Пример #3
0
 public void Reset() {
     if (currentState != null)
         currentState.Exit();
     currentState = defaultState;
     foreach (FSMState state in states)
         state.Init();
     if (currentState != null)
         currentState.Enter();
 }
Пример #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);
        }
Пример #5
0
 public void SetDefaultState(FSMState state)
 {
     defaultState = state;
 }
Пример #6
0
 public void AddState(FSMState state)
 {
     states.Add(state);
 }
Пример #7
0
 public UnitFSMState(FSMState.FSMStates type, UnitController controller, GameplayManager gm)
     : base(type)
 {
     this.controller = controller;
     this.gm = gm;
 }
Пример #8
0
 public UnitFSMState(FSMState.FSMStates type, UnitController controller) :base (type){
     this.controller = controller;
 }
Пример #9
0
 public void SetDefaultState(FSMState state) {
     defaultState = state;
 }
Пример #10
0
 public void AddState(FSMState state) {
     states.Add(state);
 }