Beispiel #1
0
    // public void AddLife(){
    //  lives[actualLifeIndex].SetActive(true);
    //  actualLifeIndex--;
    // }

    public void RemoveLife()
    {
        if (actualLifeIndex == 2)
        {
            chronoScript.EndGame();
            return;
        }

        /* if(life0.activeSelf)
         * {
         * DeactiveLife(life0);
         * return;
         * }
         * if (life1.activeSelf)
         * {
         *      DeactiveLife(life1);
         * return;
         * }
         * if(life2.activeSelf)
         * {
         *      DeactiveLife(life2);
         * return;
         * }*/

        for (var i = 0; i < lives.Length; i++)
        {
            var life = lives[i];
            if (life.activeSelf)
            {
                print(actualLifeIndex);
                lessLifeIMG();
                DeactiveLife(life);
                actualLifeIndex++;
                return;
            }
        }
    }