Пример #1
0
 public void AddCreature(Creature creature)
 {
     if (this.creature != null)
     {
         throw new SquareOccupiedException(creature, this.creature, coordinate);
     }
     this.creature = creature;
 }
Пример #2
0
 public void AddCreature(Coordinate c, Creature creature)
 {
     Square square = GetSquare(c);
     if (!square.HasCreature()) square.AddCreature(creature);
 }
 public SquareOccupiedException(Creature intruder, Creature occupant, Coordinate coordinate)
     : base(intruder.ToString() +"Cannot move to "+coordinate.ToString()+". Square is occupied by " + occupant.ToString() + ".")
 {
 }