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);
        }
    }
示例#4
0
    public void SpawnAScoreBall(ScoreBall ball)
    {
        int       selector    = Random.Range(0, 3);
        TeamColor randomColor = (TeamColor)selector;

        ball.ChangeColor(randomColor);
        SpawnABall(ball, (int)randomColor);
    }
示例#5
0
 private void OnPowerDotCollected(ScoreBall ball)
 {
     if (!ball.isPowerDot)
     {
         return;
     }
     PowerDotCollected();
 }
示例#6
0
 private void OnBallCollected(ScoreBall ball)
 {
     DotsCount -= 1;
     if (DotsCount == 0)
     {
         FinishLevel();
     }
 }
示例#7
0
    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);
     }
 }
示例#9
0
 private void OnBallSpawned(ScoreBall ball)
 {
     DotsCount += 1;
 }