// Update is called once per frame
    void Update()
    {
        if (!instantiateChildStars)
        {
            transform.Translate((targetX - transform.position.x) * .1f, (targetY - transform.position.y) * .1f, 0, Space.World);
        }
        if (!instantiateChildStars && Mathf.Abs(targetX - transform.position.x) < .05f && Mathf.Abs(targetY - transform.position.y) < .05f)
        {
            instantiateChildStars = true;
            timeStamp             = Time.time;
            moveRight             = true;
        }

        if (instantiateChildStars && childStarCount < 12)
        {
            childStarCount++;
            if (!tutorialLevel && powerPercentageController.IsWithinPercentage() && !bombInstantiated)
            {
                bombInstantiated = true;
                InstantiateBombSeekingChildStars();
            }
            else
            {
                InstantiateChildStars();
            }
            timeStamp = Time.time;
            if (childStarCount == 12)
            {
                cooldown    = .4f;
                timeStamp   = Time.time;
                startDecent = true;
            }
        }

        if (startDecent && Time.time > timeStamp + cooldown)
        {
            foreach (GameObject a in childStarArray)
            {
                childStarMovement = a.GetComponent <RockLevelChildStarMovement> ();
                childStarMovement.StartDecent();
            }
            soundHandler.PlayPowerShot();
            fiveInARow.GetMotherStarList().Remove(gameObject);
            Destroy(gameObject);
        }
    }
Esempio n. 2
0
    public void ActivateFourInARowPower(HashSet <GameObject> deleteList)
    {
        deleteJewels.StampTimeCard();
//		scoreKeeper.IncreaseScoreByFourJewelBonus ();
        bool bombStarUsed = false;

        foreach (GameObject a in deleteList)
        {
            switch (a.tag)
            {
            case "Orange Bomb":
            case "Yellow Block":
                if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed)
                {
                    InstantiateBombSeekingHomingStar(orangeHomingStar, a);
                    bombStarUsed = true;
                }
                else
                {
                    InstantiateHomingStar(orangeHomingStar, a);
                }
                break;

            case "Blue Bomb":
            case "Blue Block":
                if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed)
                {
                    InstantiateBombSeekingHomingStar(blueHomingStar, a);
                    bombStarUsed = true;
                }
                else
                {
                    InstantiateHomingStar(blueHomingStar, a);
                }
                break;

            case "Green Bomb":
            case "Green Block":
                if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed)
                {
                    InstantiateBombSeekingHomingStar(greenHomingStar, a);
                    bombStarUsed = true;
                }
                else
                {
                    InstantiateHomingStar(greenHomingStar, a);
                }
                break;

            case "Red Bomb":
            case "Red Block":
                if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed)
                {
                    InstantiateBombSeekingHomingStar(redHomingStar, a);
                    bombStarUsed = true;
                }
                else
                {
                    InstantiateHomingStar(redHomingStar, a);
                }
                break;

            case "Purple Bomb":
            case "Purple Block":
                if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed)
                {
                    InstantiateBombSeekingHomingStar(purpleHomingStar, a);
                    bombStarUsed = true;
                }
                else
                {
                    InstantiateHomingStar(purpleHomingStar, a);
                }
                break;

            case "White Bomb":
            case "White Block":
                if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed)
                {
                    InstantiateBombSeekingHomingStar(whiteHomingStar, a);
                    bombStarUsed = true;
                }
                else
                {
                    InstantiateHomingStar(whiteHomingStar, a);
                }
                break;
            }
        }
        targetJewels.Clear();
    }