Example #1
0
        public Gate(GateState state)
        {
            if (state == null)
            {
                // Start From Closed State

                this.currentGateState = new ClosedGateState(this);
            }
            this.currentGateState = state;
        }
Example #2
0
        public void changeState(GateState state)
        {
            if (state == null)
            {
                // Can't Put FSM to null state
                return;
            }

            Console.WriteLine("Changing State From : " + currentGateState.GetType().Name + " to : " + state.GetType().Name);

            this.currentGateState = state;
        }
Example #3
0
 public Gate()
 {
     // Start FSM with Closed gate State
     this.currentGateState = new ClosedGateState(this);
 }