Exemple #1
0
    /* PRIVATE METHODS */
    private void SpawnNewMiniGame()
    {
        float delay = 0f;

        // Clear game data.
        _currentGame?.Cleanup();
        _currentGame = null;

        // Clear input panel first.
        for (int i = 0; i < _inputActionPanel.childCount; i++)
        {
            RectTransform rt = _inputActionPanel.GetChild(i) as RectTransform;
            rt.DOScale(Vector3.zero, 0.35f).SetEase(Ease.InBack).OnComplete(() => Destroy(rt.gameObject));
        }
        delay += (_inputActionPanel.childCount == 0) ? 0f : 0.4f;

        DOTween.Sequence().InsertCallback(delay, () => {
            _currentGameType = (Constants.GameType)Random.Range(0, (int)Constants.GameType.AllTypes);
            _currentGameType = Constants.GameType.Yoga;
            _currentGame     = _miniGameFactory.CreateMiniGame(Constants.GameType.Yoga);
            _updateMinigame  = true;

            _instructions.text = _currentGame.Instructions;

            ShowNextInput(_currentGame.GetType());
        });
    }