コード例 #1
0
ファイル: ViewMiniGame.cs プロジェクト: galen-manuel/BearJam
    /* 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());
        });
    }
コード例 #2
0
    public MiniGame CreateMiniGame(Constants.GameType pType)
    {
        MiniGame m = null;

        switch (pType)
        {
        case Constants.GameType.Yoga:
            m = new MiniGameYoga(0, 10f);
            break;
        }

        return(m);
    }