public void ChangeState(State_1 newState)
    {
        CurrentState.Exit();

        CurrentState = newState;

        CurrentState.Enter();
    }
示例#2
0
    void Start()
    {
        state  = firstState;
        states = new List <State>();

        State_1 state1 = new State_1(bg1, panel, 0);
        State_2 state2 = new State_2(bg2, panel, 1);
        State_3 state3 = new State_3(bg3, panel, 2);

        state1.SetText(2, "ONE DAY, SHERRY AND DJANGO WENT TO THE LOCAL DOG SHOW.");

        state2.SetText(1, "THERE WERE SO MANY DOGS THERE, OF ALL SHAPES AND SIZES...");
        state2.SetText(2, "...COMPETING IN ALL SORTS OF COMPETITIONS.");

        state3.SetText(1, "ONE OF THE PRIZES IN THE CORNER CAUGHT SHERRY'S EYE.");
        state3.SetText(2, "\"DJANGO!\", SHERRY EXCLAIMED, \"YOU'VE GOTTA WIN THOSE FOR ME, BOY\"");

        states.Add(state1);
        states.Add(state2);
        states.Add(state3);
    }
 public void SetState(State_1 state)
 {
     CurrentState = state;
 }
 public void Initialize(State_1 startingState)
 {
     CurrentState = startingState;
     startingState.Enter();
 }