Exemple #1
0
    public void ClickedButton(int id)
    {
        if (miniGameStat != MGStat.play)
        {
            return;
        }

        if (select == id)
        {
            Debug.Log("Sucess");

            miniGameStat = MGStat.win;
        }
        else
        {
            miniGameStat = MGStat.lost;

            DoShake();
            Debug.Log("Fail");
        }
    }
Exemple #2
0
    private void Update()
    {
        switch (miniGameStat)
        {
        default:
        case MGStat.none:
            break;

        case MGStat.start:
            colors.Shuffle();

            for (int i = 0; i < images.Count; i++)
            {
                images[i].color = colors[i];
            }


            select = Random.Range(0, images.Count);


            image.color = colors[select];
            duration    = 10;
            durationMax = duration;

            bulle.gameObject.SetActive(true);


            miniGameStat = MGStat.play;
            break;


        case MGStat.play:

            #region Timer
            duration -= Time.deltaTime;
            #endregion


            #region UI
            image.fillAmount = duration / durationMax;
            #endregion


            if (duration <= 0)
            {
                miniGameStat = MGStat.lost;
            }
            break;



        case MGStat.win:



            miniGameStat = MGStat.end;
            break;

        case MGStat.lost:

            DoShake();
            miniGameStat = MGStat.end;
            break;


        case MGStat.end:
            image.fillAmount = 0;


            bulle.gameObject.SetActive(false);

            miniGameStat = MGStat.countdown;
            StartCoroutine(nameof(CountDownRestart));
            break;
        }
    }
Exemple #3
0
 void Start() => miniGameStat = MGStat.start;
Exemple #4
0
 private void StartMiniGame() => miniGameStat = MGStat.start;
Exemple #5
0
    IEnumerator CountDownRestart()
    {
        yield return(new WaitForSeconds(1));

        miniGameStat = MGStat.start;
    }