Beispiel #1
0
        /// <summary>
        /// AI initializing method
        /// </summary>
        /// <param name="PlayerNumber">Player number</param>
        /// <param name="Game">Played game</param>
        public virtual void Init(int PlayerNumber, IGame Game)
        {
            playerNumber = PlayerNumber;
            friends = new List<UnitPilot>();
            enemies = new List<IUnit>();
            squadrons = new List<Squadron>();
            game = Game;
            IUnit unit;

            for (int i = 0; i < game.UnitsCount; i++)
            {
                unit = game.GetUnit(i);
                if (unit.PlayerOwner == playerNumber)
                {
                    UnitPilot pilot = new UnitPilot(unit, this);
                    friends.Add(pilot);
                }
                else
                    enemies.Add(unit);
            }
            enemyAnalyzing = new EnemyAnalyzing(enemies);
            analyzingTimer = new Timer(3);
        }