Beispiel #1
0
        public override void Execute()
        {
            ballGame.ball.IsInPlay = false;
            if (config.goalScoreParticles)
            {
                var particles = ComponentPool <ParticleSystem> .Take(config.goalScoreParticles);

                particles.transform.position = ballGame.ball.transform.position;
                particles.Play();
                ComponentPool <ParticleSystem> .Return(particles, 2);

                foreach (var i in config.enableOnGoal)
                {
                    i.SetActive(true);
                }
            }
            //Add the score to the correct team in the game model.
            switch (teamType)
            {
            case TeamType.Home:
                ballGame.homeScore += goal.scoreValue;
                break;

            case TeamType.Away:
                ballGame.awayScore += goal.scoreValue;
                break;
            }
            //Next event is to reset gameplay.
            Simulation.Schedule <ResetGamePlay>(1);
        }
Beispiel #2
0
        public override void Execute()
        {
            ballGame.ball.impactAudio.Play(collision, config.ballBounceAudio);
            if (config.ballBounceParticles)
            {
                var particles = ComponentPool <ParticleSystem> .Take(config.ballBounceParticles);

                particles.transform.position = ballGame.ball.transform.position;
                particles.Play();
                ComponentPool <ParticleSystem> .Return(particles, 1);
            }

            //if the ballgame is not in possession, notifiy closer players towards the ball.
            if (!ballGame.ball.IsPossessed)
            {
                var position = ballGame.ball.transform.position;
                var A        = ballGame.GetClosestPlayer(ballGame.awayTeam.players, position);
                var B        = ballGame.GetClosestPlayer(ballGame.homeTeam.players, position);
                A.OnBallBounceNearMe(position);
                B.OnBallBounceNearMe(position);
            }
        }