コード例 #1
0
    private void MinigameFinished(IMinigame minigame, bool win)
    {
        print("Destroyed");
        minigame.DestroyMinigame();

        Minigame minigameValues = GetMinigameOfType(minigame.minigame);
        float    sanityAmount;

        if (win)
        {
            sanityAmount = minigameValues.sanityGain;
        }
        else
        {
            sanityAmount = minigameValues.sanityLoss;
        }
        currentInteractable.InMinigame = false;

        Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);

        GameManager.Instance.FreezeGame = false;
        GameManager.Instance.Sanity    += sanityAmount;
        UIEvents.EndRequest(minigame.minigame);
        UIEvents.SanityUpdate(GameManager.Instance.Sanity);
    }
コード例 #2
0
    private IEnumerator TimeToStartMinigame(Interactable interactable, float time, int index)
    {
        bool startedCountdown = false;

        while (time > 0)
        {
            // Stop countdown if player has started the minigame
            if (interactable.MinigameStarted)
            {
                interactable.MinigameStarted = false;
                yield break;
            }

            if (time <= 5.5 && !startedCountdown)
            {
                startedCountdown = true;
                UIEvents.StartFlickering(interactable.minigame);
            }

            time -= Time.deltaTime;
            yield return(null);
        }

        print("request expired " + interactable.minigame);
        float sanityAmount = MinigameManager.Instance.GetMinigameOfType(interactable.minigame).sanityLoss;

        GameManager.Instance.Sanity += sanityAmount;
        UIEvents.SanityUpdate(GameManager.Instance.Sanity);
        UIEvents.EndRequest(interactable.minigame);
        interactable.SetInteractable(false);
    }