Ejemplo n.º 1
0
 public bool Check(Location locationToCheck)
 {
     if (locationToCheck != myLocation)
         return false;
     else
         return true;
 }
Ejemplo n.º 2
0
        public void Move()
        {
            bool hidden = false;

            while(!hidden)
            {
                if (myLocation is IHasExteriorDoor && random.Next(2) > 0)
                {
                    IHasExteriorDoor hasDoor = myLocation as IHasExteriorDoor;
                    myLocation = hasDoor.DoorLocation;
                }
                int randNumber = random.Next(myLocation.Exits.Length);
                myLocation = myLocation.Exits[randNumber];

                if (myLocation is IHidingPlace)
                    hidden = true;
            }
        }
Ejemplo n.º 3
0
 public void Move()
 {
     bool hidden = false;
     while (!hidden)
     {
         if (myLocation is IHasExteriorDoor)
         {
             IHasExteriorDoor locationWithDoor =
                             myLocation as IHasExteriorDoor;
             if (random.Next(2) == 1)
                 myLocation = locationWithDoor.DoorLocation;
         }
         int rand = random.Next(myLocation.Exits.Length);
         myLocation = myLocation.Exits[rand];
         if (myLocation is IHidingPlace)
             hidden = true;
     }
 }
Ejemplo n.º 4
0
 private void MoveToANewLocation(Location location)
 {
     ++Moves;
     currentLocation = location;
     RedrawForm();
 }
Ejemplo n.º 5
0
 public bool Check(Location location)
 {
     return location == myLocation;
 }
Ejemplo n.º 6
0
 public Opponent(Location location)
 {
     myLocation = location;
     random = new Random();
 }
Ejemplo n.º 7
0
 public Opponent(Location startingLocation)
 {
     myLocation = startingLocation;
     random = new Random();
 }
Ejemplo n.º 8
0
 private void MoveToANewLocation(Location newLocation)
 {
     Moves++;
     currentLocation = newLocation;
     RedrawForm();
 }