Пример #1
0
    // Update is called once per frame
    void Update()
    {
        // Transitive state
        switch (currentStep)
        {
        case 2:
            gameStartWaitTimer        = new TimeTicker(2).Start();                                               // start timer
            Mask.transform.localScale = new Vector3(0.5f, 0.5f, 1);                                              // init mask size
            StartCoroutine(SoundManager.GetInstance().StartUpVoices[0].PlayWithDelay(0.7f, 1.5f));               // voice #1 after 0.7 secs
            StartCoroutine(SoundManager.GetInstance().StartUpVoices[Random.Range(1, 4)].PlayWithDelay(2, 1.5f)); // voice #2 after 2 secs
            currentStep++;
            return;                                                                                              // do not proceed

        case 3:
            Mask.transform.localScale *= (1 + Time.deltaTime * 5);     // scale up the mask
            if (gameStartWaitTimer.IsTimeout())
            {
                StartGame();
            }
            return;     // do not proceed
        }

        // Interactive state
        var  input        = GetInput();
        bool valueChanged = false;

        switch (currentStep)
        {
        case 0:
            int newFaction = Mathf.Clamp(Faction - input, 0, 1);
            valueChanged = Faction != newFaction;
            Faction      = newFaction;
            break;

        case 1:
            int newLevel = Mathf.Clamp(Level - input, 0, 2);
            valueChanged = Level != newLevel;
            Level        = newLevel;
            break;
        }

        if (valueChanged)
        {
            SoundManager.GetInstance().MenuMoveSound.Play();
        }

        UpdateArrow();

        if (InputUtil.GetButtonDown(0))
        {
            SoundManager.GetInstance().MenuSelectSound.Play();
            currentStep++;
        }

        if (InputUtil.GetButtonDown(1) && currentStep > 0)
        {
            currentStep--;
        }
    }
Пример #2
0
 private void WaitForButtonAndGoBackToMenu()
 {
     if (gameOverScreenWaitTimer.IsTimeout() &&
         (InputUtil.GetButtonDown(0) || InputUtil.GetButtonDown(1)))
     {
         SceneManager.LoadScene(GameConstants.MenuScene);
     }
 }
Пример #3
0
 // Update is called once per frame
 void Update()
 {
     if (InputUtil.GetButtonDown(0))
     {
         Screen.fullScreen = false;
         Application.ExternalCall("recruit");
         Destroy(gameObject);
     }
     else if (InputUtil.GetButtonDown(1))
     {
         Destroy(gameObject);
     }
 }
Пример #4
0
    // Update is called once per frame
    protected override void Update()
    {
        base.Update();

        if (GameProvider.IsGameOver)
        {
            return;
        }

        var dx = InputUtil.GetX();
        var dy = InputUtil.GetY();

        Move(dx, dy);
        CenterPlayer();

        if (InputUtil.GetButton(0))
        {
            TryAttack();
        }
        else
        {
            if (IsHaijin)
            {
                CurrentBurst = null;
            }
        }

        if (InputUtil.GetButtonDown(1))
        {
            TryCreateLink();
        }

        if (CurrentPortal != null)
        {
            TryCaptureOrRecharge(CurrentPortal, Achievement);
        }
    }