Example #1
0
 public bool Check(Location locationToCheck)
 {
     if (locationToCheck != myLocation)
         return false;
     else
         return true;
 }
Example #2
0
 public bool Check(Location location)
 {
     if (myLocation == location)
         return true;
     else
         return false;
 }
Example #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;
     }
 }
Example #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;
            }
        }
Example #5
0
 private void MoveToANewLocation(Location newLocation)
 {
     Moves++;
     currentLocation = newLocation;
     RedrawForm();
 }
Example #6
0
 public Opponent(Location startingLocation)
 {
     myLocation = startingLocation;
     random = new Random();
 }