CheckIfGoalScored() public méthode

public CheckIfGoalScored ( SoccerBall ball ) : bool
ball SoccerBall
Résultat bool
Exemple #1
0
        public void Update()
        {
            if (_paused)
            {
                return;
            }

            //update the balls
            _ball.Update();

            //update the teams
            _redTeam.Update();
            _blueTeam.Update();

            //if a goal has been detected reset the pitch ready for kickoff
            if (_blueGoal.CheckIfGoalScored(_ball) || _redGoal.CheckIfGoalScored(_ball))
            {
                _gameInPlay = false;

                //reset the ball
                _ball.PlaceAtPosition(new Vector2D((double)_clientWidth / 2.0, (double)_clientHeight / 2.0));

                //get the teams ready for kickoff
                _redTeam.FSM.ChangeState(PrepareForKickoffState.Instance);
                _blueTeam.FSM.ChangeState(PrepareForKickoffState.Instance);
            }
        }