예제 #1
0
    //Recycle the bomb
    private void ForceRecycle()
    {
        GameObject ballGeneratorObject = GameObject.Find("BallGenerator");

        if (ballGeneratorObject != null)
        {
            BallGeneratorScript ballGenerator = ballGeneratorObject.GetComponent <BallGeneratorScript> ();
            if (index != Constants.bombIndex)
            {
                ballGenerator.GetBallsBasedOnIndex(index).Remove(this);
            }
        }
    }
예제 #2
0
    //Recycle the ball
    private IEnumerator Recycle(float delayTime)
    {
        yield return(new WaitForSeconds(delayTime));

        GameObject ballGeneratorObject = GameObject.Find("BallGenerator");
        GameObject gameManagerObject   = GameObject.Find("GameManager");

        if (ballGeneratorObject != null && gameManagerObject != null)
        {
            GameManagerScript   gameManager   = gameManagerObject.GetComponent <GameManagerScript>();
            BallGeneratorScript ballGenerator = ballGeneratorObject.GetComponent <BallGeneratorScript> ();
            if (index != Constants.bombIndex)
            {
                ballGenerator.GetBallsBasedOnIndex(index).Remove(this);
            }

            if (gameManager.IsPlaying)
            {
                ballGenerator.RecycleBall(this);
                ballGenerator.IsRecycling = false;
            }
        }
    }