示例#1
0
文件: Opponent.cs 项目: saians/MyEnd
 bool Check(Location enteredLocation)
 {
     if (enteredLocation != mylocation)
     {
         return false;
     }
     return true;
 }
示例#2
0
文件: Form1.cs 项目: saians/MyEnd
        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;
                }

            }
        }
示例#3
0
文件: Opponent.cs 项目: saians/MyEnd
 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;
             }
         }
     }
 }
示例#4
0
文件: Opponent.cs 项目: saians/MyEnd
 public Opponent(Location startingLocation)
 {
     this.mylocation = startingLocation;
     random = new Random();
 }