Example #1
0
    void Update()
    {
#if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            debugTextField.gameObject.SetActive(!debugTextField.gameObject.activeSelf);
        }
#endif

        if (ScreenState == PlayerScreenState.Cinematic && Input.anyKeyDown)
        {
            gameMenu.ShowMainMenu();
        }
        else if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (ScreenState == PlayerScreenState.Minigame)
            {
                currMinigame.Uninit();
                currMinigame = null;
                OnEndSingle();
            }
            else if (ScreenState == PlayerScreenState.SubMainMenu)
            {
                gameMenu.OnCreditsBackClick();
            }
            else if (ScreenState == PlayerScreenState.MainMenu)
            {
                gameMenu.OnExitClick();
            }
        }
    }
Example #2
0
    void StartSingleMinigame(BaseBaseMinigame minigame)
    {
        Debug.Log($"Start new minigame. Single: {minigame.transform.name}");
        currMinigame = Instantiate(minigame.gameObject, transform).GetComponent <BaseBaseMinigame>();

        currMinigame.onWinEvent  += OnEndSingle;
        currMinigame.onLoseEvent += OnEndSingle;

        currMinigame.Init(currDifficulty);
    }
Example #3
0
    void StartNewMinigameInSequence()
    {
        Debug.Log($"Start new minigame. Id: {currMinigameId}");
        currMinigame = Instantiate(minigames[currMinigameId].gameObject, transform).GetComponent <BaseBaseMinigame>();

        currMinigame.onWinEvent  += OnWinMinigameInSequence;
        currMinigame.onLoseEvent += OnLoseMinigameInSequence;

        currMinigame.Init(currDifficulty);
    }
Example #4
0
    public void PlayMinigame(MinigameType type)
    {
        BaseBaseMinigame minigame = null;

        for (byte i = 0; i < minigames.Count; ++i)
        {
            if (minigames[i].type == type)
            {
                minigame = minigames[i];
                break;
            }
        }

        if (minigame != null)
        {
            ScreenState = PlayerScreenState.Minigame;
            gameMenu.HideMainMenu();
            StartSingleMinigame(minigame);
        }
    }