Exemple #1
0
    private void ShowRoundText()
    {
        numRounds++;
        roundText.text = "Round " + numRounds + " Begins";
        if (numRounds == 1)
        {
            numRoundsTextLoseMenu.text = "You made it " + numRounds + " round!";
        }
        else
        {
            numRoundsTextLoseMenu.text = "You made it " + numRounds + " rounds!";
        }

        roundText.gameObject.SetActive(true);
        StartCoroutine(UsefulStuff.DoAfter(1.5f, () => { roundText.gameObject.SetActive(false); }));
    }
Exemple #2
0
    private void Start()
    {
        //SetCostText(cost);
        SetChargesText(numCharges);

        onClick.AddListener(() =>
        {
            if (numCharges > 0)
            {
                IEnumerator done = null;
                done             = GetButtonAction();

                if (done != null)
                {
                    RemoveCharge();
                    StartCoroutine(done);
                    GoOnCooldown();
                    if (activeFX != null && !activeFX.activeInHierarchy)
                    {
                        activeFX.SetActive(true);
                        StartCoroutine(UsefulStuff.DoAfter(duration, () =>
                        {
                            activeFX.SetActive(false);
                        }));
                    }
                }
            }
            else
            {
                if (audioMod != null)
                {
                    audioMod.PlayAudioClip(0);
                }
            }
        });

        //if (scoreTracker != null)
        //{


        //    //scoreTracker.updated.AddListener(SetFillAmount);
        //}
    }
Exemple #3
0
    private IEnumerator GetButtonAction()
    {
        switch (powerUp)
        {
        case PowerUp.MouseOverDestroy:
            if (!FallingObject.passive)
            {
                FallingObject.passive = true;

                if (audioMod != null)
                {
                    audioMod.PlayAudioClip(3);
                }

                return(UsefulStuff.DoAfter(duration, () =>
                {
                    FallingObject.passive = false;
                }));
            }
            break;

        case PowerUp.FreezeAll:
            if (!FallingObject.freeze)
            {
                FallingObject.freeze       = true;
                ObjectSpawner.stopSpawning = true;

                if (audioMod != null)
                {
                    audioMod.PlayAudioClip(1);
                }

                return(UsefulStuff.DoAfter(duration, () =>
                {
                    FallingObject.freeze = false;
                    ObjectSpawner.stopSpawning = false;
                }));
            }
            break;

        case PowerUp.DestroyAll:
            if (!FallingObject.destroy)      // activate on condition?
            {
                if (audioMod != null)
                {
                    audioMod.PlayAudioClip(2);
                }

                ObjectSpawner.stopSpawning = true;
                FallingObject.destroy      = true;
                return(UsefulStuff.DoAfter(duration, () =>
                {
                    FallingObject.destroy = false;
                    ObjectSpawner.stopSpawning = false;
                }));
            }
            break;

        default:
            break;
        }

        return(null);
    }