Exemplo n.º 1
0
 void OnGame()
 {
     if (GunControl.IsFireInput())
     {
         if (gun.FireGun())
         {
             fired = true;
         }
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (state != State.Idle)
        {
            this.timer += Time.deltaTime;
        }

        switch (state)
        {
        case State.Idle:
            SetPositions(0);
            if (GunControl.IsFireInput())
            {
                SetState(State.Ready);
                Play(Ready);
                NewGame();
            }
            break;

        case State.Ready:
            SetPositions(timer);
            if (timer > 1)
            {
                SetState(State.Game);
                Play(Begin);
            }
            break;

        case State.Game:
            SetPositions(1);
            OnGame();
            if (timer > 15)
            {
                SetState(State.Game3);
                Play(Three);
            }
            break;

        case State.Game3:
            SetPositions(1);
            OnGame();
            if (timer > 1)
            {
                SetState(State.Game2);
                Play(Two);
            }
            break;

        case State.Game2:
            SetPositions(1);
            OnGame();
            if (timer > 1)
            {
                SetState(State.Win);
                Play(One);
            }
            break;

        case State.Win:
            SetPositions(1 - timer);
            if (timer > 1)
            {
                SetState(State.Score);
                Play(Win);
            }
            break;

        case State.Score:
            SetPositions(0);
            if (timer > 1)
            {
                SetState(State.Idle);
                Play(Flawless);
            }
            break;
        }
    }