private void UpdateText() { BallSpawn ball = new BallSpawn(); cubeCountText.text = "Cubes Left: " + cubeCount; ballCountText.text = "Balls Left: " + ballCount; }
private void SpawnBall(Vector2 levelCenter, Vector2 normalizedDirection) { _ball = Instantiate(ball, levelCenter, Quaternion.identity); _ball.GetComponent <Rigidbody2D>().velocity = normalizedDirection * ball.GetComponent <Ball>().ballSpeed; BallSpawn?.Invoke(_ball); }
private void Start() { cubeCount = cubes.childCount; StartCoroutine("UpdateCanvas"); BallSpawn ball = new BallSpawn(); ballCount = ball.BallCount; }
void Awake() { if (bs == null) { bs = this; } else if (bs != this) { Destroy(gameObject); } }
// Use this for initialization void Start() { ballTimer = gameObject.AddComponent <Timer>(); ballTimer.AddTimerFinishedListener(HandleBallTimerFinished); ballTimer.Duration = ConfigurationUtils.BallLifeTime; ballTimer.Run(); moveTimer = gameObject.AddComponent <Timer>(); moveTimer.AddTimerFinishedListener(HandleMoveTimerFinished); moveTimer.Duration = 1; moveTimer.Run(); speedUpTimer = gameObject.AddComponent <Timer>(); speedUpTimer.AddTimerFinishedListener(HandleSpeedUpTimerFinished); speedUp = false; EventManager.AddSpeedUpEffectListener(HandleSpeedUpEffect); ballMiss = new BallMiss(); EventManager.AddBallMissInvoker(this); ballSpawn = new BallSpawn(); EventManager.AddBallSpawnInvoker(this); }