private void CallBallCollected(ScoreBall ball) { if (BallCollected != null) { BallCollected(ball); } }
private void CallBallSpawned(ScoreBall ball) { if (BallSpawned != null) { BallSpawned(ball); } }
private void SpawnDots(bool hasPowerDot) { _dots = new List <ScoreBall>(DotsCount); var prop = new DotProperties { Target = target, Interval = _oneOverZigs, DotsCount = DotsCount, Scale = scale, Speed = speed, Parent = this }; for (int i = 0; i < DotsCount; i++) { ScoreBall newDot = null; if (hasPowerDot && i == DotsCount / 2) { newDot = Instantiate(PowerDotPrefab).GetComponent <PowerDot>(); } else { newDot = Instantiate(DotPrefab).GetComponent <Dot>(); } ((Dot)newDot).Init(i, prop); newDot.transform.parent = transform; _dots.Add(newDot); } }
public void SpawnAScoreBall(ScoreBall ball) { int selector = Random.Range(0, 3); TeamColor randomColor = (TeamColor)selector; ball.ChangeColor(randomColor); SpawnABall(ball, (int)randomColor); }
private void OnPowerDotCollected(ScoreBall ball) { if (!ball.isPowerDot) { return; } PowerDotCollected(); }
private void OnBallCollected(ScoreBall ball) { DotsCount -= 1; if (DotsCount == 0) { FinishLevel(); } }
private void OnTriggerEnter(Collider other) { ScoreBall ball = other.gameObject.GetComponent <ScoreBall>(); if (ball == null) { return; } score.TotalScore += ball.Score; ball.Dead(); }
private void ScoreBall_BallCollected(ScoreBall ball) { if (typeof(PowerDot) == ball.GetType()) { PowerDotSource.Play(); MusicSource.Stop(); FastMusicSource.Play(); Invoke("ChangeIsFrightened", Enemy.FrightenedTimer); } else { var eating = Instantiate(EatingPrefab).GetComponent <AudioSource>(); eating.Play(); eatingSounds.Add(eating); } }
private void OnBallSpawned(ScoreBall ball) { DotsCount += 1; }