public SoccerTeam(SoccerGoal homeGoal, SoccerGoal opponentsGoal, SoccerPitch pitch, SoccerTeamColor color)
        {
            _homeGoal = homeGoal;
            _opponentsGoal = opponentsGoal;
            _pitch = pitch;
            _color = color;

            _opposingTeam = null;
            _distSqToBallOfClosestPlayer = 0.0;
            _supportingPlayer = null;
            _controllingPlayer = null;
            _playerClosestToBall = null;

            _stateMachine = new StateMachine<SoccerTeam>(this);

            _stateMachine.CurrentState = DefendingState.Instance;
            _stateMachine.PreviousState = DefendingState.Instance;
            _stateMachine.GlobalState = null;

            //create the players and goalkeeper
            CreatePlayers();

            //set default steering behaviors
            foreach (PlayerBase player in _players)
            {
                player.SteeringBehaviors.Seperation = true;
            }

            _supportSpotCalculator = new SupportSpotCalculator(ParameterManager.Instance.NumSupportSpotsX, ParameterManager.Instance.NumSupportSpotsY, this);
        }
Exemple #2
0
        public SoccerTeam(SoccerGoal homeGoal, SoccerGoal opponentsGoal, SoccerPitch pitch, SoccerTeamColor color)
        {
            _homeGoal      = homeGoal;
            _opponentsGoal = opponentsGoal;
            _pitch         = pitch;
            _color         = color;

            _opposingTeam = null;
            _distSqToBallOfClosestPlayer = 0.0;
            _supportingPlayer            = null;
            _controllingPlayer           = null;
            _playerClosestToBall         = null;

            _stateMachine = new StateMachine <SoccerTeam>(this);

            _stateMachine.CurrentState  = DefendingState.Instance;
            _stateMachine.PreviousState = DefendingState.Instance;
            _stateMachine.GlobalState   = null;

            //create the players and goalkeeper
            CreatePlayers();

            //set default steering behaviors
            foreach (PlayerBase player in _players)
            {
                player.SteeringBehaviors.Seperation = true;
            }

            _supportSpotCalculator = new SupportSpotCalculator(ParameterManager.Instance.NumSupportSpotsX, ParameterManager.Instance.NumSupportSpotsY, this);
        }