Beispiel #1
0
 bool Check(Location enteredLocation)
 {
     if (enteredLocation != mylocation)
     {
         return false;
     }
     return true;
 }
Beispiel #2
0
        private void MoveToANewLocation(Location location)
        {
            this.currentLocation = location;
            exits.Items.Clear();
            for (int i = 0; i < location.Exists.Length; i++)
            {
                exits.Items.Add(location.Exists[i].Name);
                exits.SelectedIndex = 0;

                description.Text = location.Description;

                if (location is IHasExteriorDoor) { goThroughTheDoor.Visible = true; }
                else
                {
                    goThroughTheDoor.Visible = false;
                }

            }
        }
Beispiel #3
0
 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.Exists.Length);
             mylocation = mylocation.Exists[rand];
             if (mylocation is IHidingPlace)
             {
                 hidden = true;
             }
         }
     }
 }
Beispiel #4
0
 public Opponent(Location startingLocation)
 {
     this.mylocation = startingLocation;
     random = new Random();
 }