Esempio n. 1
0
    /// <summary>
    /// This function is used to remove a destroyed monster from the list.
    /// </summary>
    /// -This function gets called from the MonterScript-
    public void RemoveMonster(GameObject obj)
    {
        _monsters.Remove(obj);
        if (_monsters.Count <= 0 && !PlayerScript.instance.IsDead())
        {
            PlayerInfoScript info = PlayerInfoScript.instance;
            if (PlayerScript.instance._IsTesting) //If you are using a computer, lock the mouse to the middle of the Game window
            {
                Cursor.lockState = CursorLockMode.None;
            }

            //Update the stats of the player
            info.AddLevelInSugarGroup();
            _winPanel.SetActive(true);                                                       //Display win screen
            string stats = "Coins: " + info.GetCoinsFromLevel() + "\nXP: " + info.GetXpFromLevel();
            _winPanel.transform.Find("Stats").GetComponent <TextMeshProUGUI>().text = stats; //Update stats
        }
    }