Esempio n. 1
0
 private void Initialize()
 {
     for (int y = 0; y < Height; y++)
     {
         for (int x = 0; x < Width; x++)
         {
             Places[x, y] = new BattlefieldPlace(x, y);
         }
     }
 }
Esempio n. 2
0
        public void Set(IBattleBot battleBot, int newX, int newY)
        {
            if (battleBot == null)
            {
                throw new ArgumentNullException(nameof(battleBot));
            }
            if (IsOutOfRange(newX, newY))
            {
                throw new ArgumentOutOfRangeException();
            }
            var oldPlace = this[battleBot];

            if (oldPlace != null)
            {
                Places[oldPlace.X, oldPlace.Y] = new BattlefieldPlace(oldPlace.X, oldPlace.Y);
            }
            Places[newX, newY] = new BattlefieldPlace(newX, newY, battleBot);
        }