Exemplo n.º 1
0
    public void EnableBarrier(bool enabled)
    {
        //LogoObject.SetActive(!enabled);

        if (enabled)
        {
            _IsIgnoreInput = false;
        }
        else
        {
            _isBarrierOpen = true;
            _IsIgnoreInput = true;
            HideAllUI();
            //GZ_Crowd.Instance.DestroyCrowd();
            //GZ_CircleTable.Instance.ClearTable();

            StartCoroutine(GZ_Math.PlayAnim_CR(0.5f,
                                               (progress) =>
            {
                EnableScoreBoard(1f - progress);
                Barrier.transform.localScale = Vector3.one * Mathf.Lerp(0.2f, 0, 1 - progress);
            },
                                               () =>
            {
            }));
        }
    }
Exemplo n.º 2
0
    void StartGame()
    {
        _IsIgnoreInput = true;
        GZ_Crowd.Instance.CreateCrowd();



        StartCoroutine(GZ_Math.PlayAnim_CR(0.5f,
                                           (progress) =>
        {
            Barrier.transform.localScale = Vector3.one * Mathf.Lerp(0.2f, 0, progress);
        },
                                           () =>
        {
            Scoreboard[0].text = Scoreboard[1].text = "0";
            TotalScores[0]     = TotalScores[1] = 0;

            _currentPlayerIndex = -1;
            _players            = new GZ_Player[NumPlayer];

            for (int i = 0; i < NumPlayer; i++)
            {
                _players[i].Index     = i;
                _players[i].TileScore = _players[i].ComboScore = 0;
                _players[i].PColor    = PlayerColors[i];
            }

            StartCoroutine(GZ_Math.PlayAnim_CR(1f,
                                               (percentage) =>
            {
                EnableScoreBoard(percentage);
            },
                                               () =>
            {
                GZ_RadioEmitter.Instance.Bang();
                _IsIgnoreInput = false;

                GZ_CircleTable.Instance.SpawnTable(RowCount, ColCount);

                TotalTileCount    = RowCount * ColCount;
                OccupiedTileCount = 0;

                SwitchPlayer();
            }));
        }));
    }
Exemplo n.º 3
0
    public void RestartGame()
    {
        _IsIgnoreInput = true;
        _isBarrierOpen = false;

        GZ_CircleTable.Instance.ClearTable();

        StartCoroutine(GZ_Math.PlayAnim_CR(0.5f,
                                           (progress) =>
        {
            EnableScoreBoard(1f - progress);
            Barrier.transform.localScale = Vector3.one * Mathf.Lerp(0.2f, 0, 1 - progress);
        },
                                           () =>
        {
            StartGame();
        }));
    }
Exemplo n.º 4
0
    public void EnableRecordSession(bool enabled)
    {
        RecordObject.SetActive(enabled);

        if (enabled)
        {
            StartCoroutine(GZ_Math.PlayAnim_CR(0.5f,
                                               (progress) =>
            {
                EnableScoreBoard(1f - progress);
                Barrier.transform.localScale = Vector3.one * Mathf.Lerp(0.2f, 0, 1 - progress);
            },
                                               () =>
            {
            }));
        }
        else
        {
            StartGame();
        }
    }
Exemplo n.º 5
0
    void SwitchPlayer()
    {
        _IsIgnoreInput = true;

        GZ_AudioModule.Instance.Play(2);
        _currentPlayerIndex = ++_currentPlayerIndex % NumPlayer;

        SwitchPlayerImage[_currentPlayerIndex].SetActive(true);

        GZ_RadioEmitter.Instance.Bang();

        StartCoroutine(
            GZ_Math.PlayAnim_CR(
                0.5f,
                (percentage) => // scale up
        {
            var value = MainUIEnableCurve.Evaluate(percentage);
            SwitchPlayerImage[_currentPlayerIndex].transform.localScale = Vector3.one * value;
        },
                () => /* done callback */
        {
            //Switch Player
            StartCoroutine(GZ_Math.WaitFor_CR(1f,
                                              () =>
            {
                StartCoroutine(GZ_Math.PlayAnim_CR(0.5f,     //Scale down
                                                   (percent) =>
                {
                    var value = MainUIEnableCurve.Evaluate(1f - percent);
                    SwitchPlayerImage[_currentPlayerIndex].transform.localScale = Vector3.one * value;
                },
                                                   () =>
                {
                    _IsIgnoreInput = false;
                    SwitchPlayerImage[_currentPlayerIndex].SetActive(false);
                }));
            }));
        }));
    }