Ejemplo n.º 1
0
    private IEnumerator PlayerWins()
    {
        yield return(new WaitForSeconds(1.5f));

        PlayerWinsMenu menu = (PlayerWinsMenu)MenusHandler.MenusManager.Instance.ShowMenu("PlayerWinsMenu");

        menu.SetPlayerIndex(_aliveChildren[0].Index);
    }
Ejemplo n.º 2
0
    private void CheckIfSleeping()
    {
        if (_gameOver)
        {
            return;
        }

        List <Child> safeChildren = new List <Child>();

        foreach (Child child in Children)
        {
            if (child == null)
            {
                continue;
            }

            Debug.Log(child.IsSleeping);

            if (child.IsSleeping)
            {
                safeChildren.Add(child);
            }
            else
            {
                Debug.Log("Player " + child.Index + " has been spotted by mom.");

                // TODO: Visual animation that the player lost (lasso?)

                child.NumZ = 4;
                _aliveChildren.Remove(child);
                Destroy(child.gameObject);
            }
        }

        if (safeChildren.Count == 0)
        {
            Debug.Log("Mom wins!");

            MusicManager.Instance.PlayDefeatMusic();

            StartCoroutine(MomWins());

            _gameOver = true;
        }
        else if (safeChildren.Count == 1)
        {
            _gameOver = true;

            Debug.Log("Player " + safeChildren[0].Index + " wins!");

            PlayerWinsMenu menu = (PlayerWinsMenu)MenusManager.Instance.ShowMenu("PlayerWinsMenu");
            menu.SetPlayerIndex(safeChildren[0].Index);

            MusicManager.Instance.PlayVictoryMusic();

            _gameOver = true;
        }
    }