/// <summary>
        /// Initializes a new instance of the <see cref="Player"/> class.
        /// </summary>
        /// <param name="player">The football player.</param>
        /// <param name="footballAI">The <see cref="FsmAI"/> instance to which this player belongs.</param>
        protected Player(FootballPlayer player, FsmAI footballAI) : base(player.Id)
        {
            AI = footballAI;

            Position   = player.Position;
            Movement   = player.Movement;
            KickVector = player.KickVector;

            Speed      = player.Speed;
            KickPower  = player.KickPower;
            Possession = player.Possession;
            Precision  = player.Precision;

            SteeringBehaviorsManager = new SteeringBehaviorsManager(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Team"/> class.
        /// </summary>
        /// <param name="footballPlayers">The team's football players.</param>
        /// <param name="ai">The <see cref="FsmAI"/> instance to which this instance belongs.</param>
        public Team(IList <FootballPlayer> footballPlayers, FsmAI ai)
        {
            AI = ai;

            StateMachine = new FiniteStateMachine <Team>(this, new Kickoff(this, ai), new TeamGlobalState(this, ai));
            InitialEnter = true;

            Players           = new Player[11];
            SupportingPlayers = new List <Player>();

            GoalKeeper = new GoalKeeper(footballPlayers[0], ai);
            Players[0] = GoalKeeper;

            Defenders = new List <Defender>(4);
            for (int i = 1; i <= 4; i++)
            {
                var defender = new Defender(footballPlayers[i], ai);
                Defenders.Add(defender);
                Players[i] = defender;
            }

            Midfielders = new List <Midfielder>(4);
            for (int i = 5; i <= 8; i++)
            {
                var midfielder = new Midfielder(footballPlayers[i], ai);
                Midfielders.Add(midfielder);
                Players[i] = midfielder;
            }

            Forwards = new List <Forward>(2);
            for (int i = 9; i <= 10; i++)
            {
                var forward = new Forward(footballPlayers[i], ai);
                Forwards.Add(forward);
                Players[i] = forward;
            }

            // important because enter method of the players state is called before team state enter method
            // in GetActions function during initial enter
            var teamState = StateMachine.CurrentState as TeamState;

            if (teamState != null)
            {
                teamState.SetHomeRegions();
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TeamGlobalState" /> class.
 /// </summary>
 /// <param name="team">The <see cref="Team"/> to which this instance belongs.</param>
 /// <param name="footballAI">The <see cref="FsmAI"/> instance to which this instance belongs.</param>
 public TeamGlobalState(Team team, FsmAI footballAI) : base(team, footballAI)
 {
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TeamState"/> class.
 /// </summary>
 /// <param name="team">The <see cref="Team"/> to which this instance belongs.</param>
 /// <param name="footballAI">The <see cref="FsmAI"/> instance to which this instance belongs.</param>
 protected TeamState(Team team, FsmAI footballAI) : base(team, footballAI)
 {
     Team = team;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SupportControlling"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public SupportControlling(Player player, FsmAI footballAI) : base(player, footballAI)
 {
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GoalKeeper"/> class.
 /// </summary>
 /// <param name="player">The football player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this player belongs.</param>
 public GoalKeeper(FootballPlayer player, FsmAI footballAI) : base(player, footballAI)
 {
     StateMachine = new FiniteStateMachine <Player>(this, new Default(this, footballAI), new GoalKeeperGlobalState(this, footballAI));
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Attacking" /> class.
 /// </summary>
 /// <param name="team">The <see cref="Team" /> to which this instance belongs.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public Attacking(Team team, FsmAI footballAI) : base(team, footballAI)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceivePass"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The football ai.</param>
 /// <param name="passTarget">The pass target.</param>
 public ReceivePass(Player player, FsmAI footballAI, Vector passTarget) : base(player, footballAI)
 {
     PassTarget = passTarget;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InterceptBall"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public InterceptBall(Player player, FsmAI footballAI) : base(player, footballAI)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="KickBall"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public KickBall(Player player, FsmAI footballAI) : base(player, footballAI)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Forward"/> class.
 /// </summary>
 /// <param name="player">The football player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this player belongs.</param>
 public Forward(FootballPlayer player, FsmAI footballAI) : base(player, footballAI)
 {
     StateMachine = new FiniteStateMachine <Player>(this, new Default(this, footballAI), new ForwardGlobalState(this, footballAI));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefendGoal"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public DefendGoal(Player player, FsmAI footballAI) : base(player, footballAI)
 {
 }
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlayerState" /> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI"/> instance to which this instance belongs.</param>
 protected PlayerState(Player player, FsmAI footballAI) : base(player, footballAI)
 {
     Player = player;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Default" /> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public Default(Player player, FsmAI footballAI) : base(player, footballAI)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Kickoff" /> class.
 /// </summary>
 /// <param name="team">The <see cref="Team" /> to which this instance belongs.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public Kickoff(Team team, FsmAI footballAI) : base(team, footballAI)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ForwardGlobalState"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public ForwardGlobalState(Player player, FsmAI footballAI) : base(player, footballAI)
 {
     FieldPlayerGlobalState = new FieldPlayerGlobalState(player, footballAI);
 }
Esempio n. 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlayerGlobalState"/> class.
 /// </summary>
 /// <param name="entity">The entity to which this instance belongs.</param>
 /// <param name="footballAI">The <see cref="T:FootballAIGame.Client.AIs.Fsm.FsmAI" /> instance to which this player belongs.</param>
 public PlayerGlobalState(Player entity, FsmAI footballAI) : base(entity, footballAI)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MoveToHomeRegion"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public MoveToHomeRegion(Player player, FsmAI footballAI) : base(player, footballAI)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Dribble"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public Dribble(Player player, FsmAI footballAI) : base(player, footballAI)
 {
 }
Esempio n. 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MidfielderGlobalState"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public MidfielderGlobalState(Player player, FsmAI footballAI) : base(player, footballAI)
 {
     FieldPlayerGlobalState = new FieldPlayerGlobalState(player, footballAI);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Defending" /> class.
 /// </summary>
 /// <param name="team">The <see cref="Team" /> to which this instance belongs.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public Defending(Team team, FsmAI footballAI) : base(team, footballAI)
 {
 }
Esempio n. 22
0
 public GoalKeeperGlobalState(Player player, FsmAI footballAI) : base(player, footballAI)
 {
     PlayerGlobalState = new PlayerGlobalState(player, footballAI);
 }
Esempio n. 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PursueBall"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public PursueBall(Player player, FsmAI footballAI) : base(player, footballAI)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldPlayer"/> class.
 /// </summary>
 /// <param name="player">The football player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this player belongs.</param>
 protected FieldPlayer(FootballPlayer player, FsmAI footballAI) :
     base(player, footballAI)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SupportPositionsManager"/> class.
 /// </summary>
 /// <param name="footballAI">The <see cref="FsmAI"/> instance to which this instance belongs.</param>
 public SupportPositionsManager(FsmAI footballAI)
 {
     AI = footballAI;
     CreateSupportPositions();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldPlayerGlobalState"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="footballAI">The <see cref="FsmAI" /> instance to which this instance belongs.</param>
 public FieldPlayerGlobalState(Player player, FsmAI footballAI) : base(player, footballAI)
 {
     PlayerGlobalState = new PlayerGlobalState(player, footballAI);
 }