Example #1
0
    public void MarshDestroyed()
    {
        GameObject[] tMarshArray = GameObject.FindGameObjectsWithTag("Marshmellows");
        foreach (GameObject tGO in tMarshArray)
        {
            Destroy(tGO);
        }
        int        cocoaIndex = cocoaList.Count - 1;
        GameObject tCocoaGO   = cocoaList[cocoaIndex];

        cocoaList.RemoveAt(cocoaIndex);
        Destroy(tCocoaGO);
        int live = int.Parse(playerLives.text);

        live            -= 1;
        playerLives.text = live.ToString();
        //rstart
        if (cocoaList.Count == 0)
        {
            hs.EndGame();
            SceneManager.LoadScene("End");
        }
    }