public bool Check(Location locationToCheck) { if (myLocation == locationToCheck) return true; else return false; }
public void Move() { if (myLocation is RoomWithDoor) { if (random.Next(2) == 1) // go through door? { RoomWithDoor nextLocation = myLocation as RoomWithDoor; myLocation = nextLocation.DoorLocation; } } do { myLocation = myLocation.Exits[random.Next(myLocation.Exits.Length)]; // go through a random exit } while (!(myLocation is IHidingPlace)); // repeat if no hiding place }
//private Location currentLocation { get; set; } private void moveToANewLocation(Location newLocation) { Moves++; currentLocation = newLocation; redrawForm(); //comboBoxExits.Items.Clear(); //foreach (Location item in currentLocation.Exits) //{ // comboBoxExits.Items.Add(item.Name); //} //comboBoxExits.SelectedIndex = 0; //textBoxDescription.Text = currentLocation.Description; //if (currentLocation is IHasExteriorDoor) // buttonGoThroughDoor.Visible = true; //else // buttonGoThroughDoor.Visible = false; }
public Opponent(Location myLocation) { this.myLocation = myLocation; random = new Random(); }