Esempio n. 1
0
 bool Check(Location enteredLocation)
 {
     if (enteredLocation != mylocation)
     {
         return false;
     }
     return true;
 }
Esempio n. 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;
                }

            }
        }
Esempio n. 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;
             }
         }
     }
 }
Esempio n. 4
0
 public Opponent(Location startingLocation)
 {
     this.mylocation = startingLocation;
     random = new Random();
 }