Beispiel #1
0
    IEnumerator ActivatePartyTime()
    {
        partyTimeOn     = true;
        ball.ballSpeed *= (1 + ballSpeedIncrease);
        for (int newBallIndex = 1; newBallIndex <= extraBalls; newBallIndex++)
        {
            GameObject extraBall       = Instantiate(ball.gameObject, ball.transform.position, Quaternion.identity);
            Vector2    trajectoryTweak = new Vector2(
                UnityEngine.Random.Range(-launchAngleOffset, launchAngleOffset),
                UnityEngine.Random.Range(-launchAngleOffset, launchAngleOffset));
            extraBall.GetComponent <Rigidbody2D>().AddForce(trajectoryTweak);
        }

        yield return(new WaitUntil(() => partyTimeOn == false));

        ball            = FindObjectOfType <Ball>();
        ballTrail       = ball.GetComponentInChildren <TrailColor>();
        ball.ballSpeed /= (1 + ballSpeedIncrease);
        powerOn         = false;
    }
Beispiel #2
0
 void Start()
 {
     ball         = FindObjectOfType <Ball>();
     ballTrail    = ball.GetComponentInChildren <TrailColor>();
     displayPower = FindObjectOfType <DisplayPowerCount>();
 }