Пример #1
0
 public bool Check(Location locationToCheck)
 {
     if (locationToCheck != myLocation)
         return false;
     else
         return true;
 }
Пример #2
0
 public bool Check(Location location)
 {
     if (myLocation == location)
         return true;
     else
         return false;
 }
Пример #3
0
 public void Move()
 {
     if (myLocation is IHasExteriorDoor)
     {
         IHasExteriorDoor LocationWithDoor =
                             myLocation as IHasExteriorDoor;
         if (random.Next(2) == 1)
             myLocation = LocationWithDoor.DoorLocation;
     }
     bool hidden = false;
     while (!hidden)
     {
         int rand = random.Next(myLocation.Exits.Length);
         myLocation = myLocation.Exits[rand];
         if (myLocation is IHidingPlace)
             hidden = true;
     }
 }
Пример #4
0
        public void Move()
        {
            if(myLocation is IHasExteriorDoor)
            {
                IHasExteriorDoor LocationHasDoor = myLocation as IHasExteriorDoor;

                if (random.Next(2) == 1)
                    myLocation = LocationHasDoor.DoorLocation;
            }

            bool hidingPLace = false;

            while (!hidingPLace)
            {
                int index = random.Next(myLocation.Exits.Length);
                myLocation = myLocation.Exits[index];
                if (myLocation is IHidingPlace)
                    hidingPLace = true;
            }
        }
Пример #5
0
 private void MoveToANewLocation(Location newLocation)
 {
     Moves++;
     currentLocation = newLocation;
     RedrawForm();
 }
Пример #6
0
 public Opponent(Location startingLocation)
 {
     myLocation = startingLocation;
     random = new Random();
 }