Beispiel #1
0
        /// <summary>
        /// Gets the <see cref="AIAction" /> for the specified <see cref="GameState" />.
        /// </summary>
        /// <param name="gameState">The state of the game.</param>
        /// <returns>
        /// The <see cref="AIAction" /> for the specified <see cref="GameState" />.
        /// </returns>
        public AIAction GetAction(GameState gameState)
        {
            if (gameState.Step == 0 || MyTeam == null)
            {
                Ball         = new Ball(gameState.Ball);
                MyTeam       = new Team(GetParameters(), this);
                OpponentTeam = new Team(GetParameters(), this); // expect opponent to have the same parameters
            }

            // AI entities (wrappers of SimulationEntities) are set accordingly
            Ball.LoadState(gameState);
            OpponentTeam.LoadState(gameState, false); // must be loaded before my team!
            MyTeam.LoadState(gameState, true);

            SupportPositionsManager.Update();

            // new action
            var currentAction = new AIAction
            {
                Step          = gameState.Step,
                PlayerActions = MyTeam.GetActions()
            };

            return(currentAction);
        }