Exemple #1
0
    public void PopBubble()
    {
        if (transform.childCount > 0)
        {
            foreach (Transform child in transform)
            {
                if (!killZoned)
                {
                    switch (child.gameObject.name)
                    {
                    case "bomb":
                        gameLogic.Gameover();
                        break;

                    case "star":
                        gameLogic.AddScore(value);
                        gameLogic.stars.Push(child.gameObject);
                        child.transform.SetParent(starsParent.transform);
                        break;

                    case "plus":
                        gameLogic.AddTime(value);
                        gameLogic.plusses.Push(child.gameObject);
                        child.transform.SetParent(plussesParent.transform);
                        break;

                    case "random":
                        PopRandom();
                        gameLogic.randoms.Push(child.gameObject);
                        child.transform.SetParent(randomsParent.transform);
                        break;
                    }
                }

                if (killZoned)
                {
                    switch (child.gameObject.name)
                    {
                    case "bomb":
                        gameLogic.bombs.Push(child.gameObject);
                        child.transform.SetParent(bombsParent.transform);
                        break;

                    case "star":
                        gameLogic.stars.Push(child.gameObject);
                        child.transform.SetParent(starsParent.transform);
                        break;

                    case "plus":
                        gameLogic.plusses.Push(child.gameObject);
                        child.transform.SetParent(plussesParent.transform);
                        break;

                    case "random":
                        gameLogic.randoms.Push(child.gameObject);
                        child.transform.SetParent(randomsParent.transform);
                        break;
                    }
                }
                gameObject.SetActive(false);
                gameLogic.bubbles.Push(gameObject);
                gameLogic.activeBubbles -= 1;

                child.gameObject.SetActive(false);
            }
        }
    }