Exemplo n.º 1
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);
    }