bool Check(Location enteredLocation) { if (enteredLocation != mylocation) { return false; } return true; }
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; } } }
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; } } } }
public Opponent(Location startingLocation) { this.mylocation = startingLocation; random = new Random(); }