public bool Check(Location locationToCheck) { if (locationToCheck != this.myLocation) { return false; } else { return true; } }
public void Move() { if (this.myLocation is IHasExteriorDoor) { IHasExteriorDoor LocationWithDoor = this.myLocation as IHasExteriorDoor; if (this.random.Next(2) == 1) { this.myLocation = LocationWithDoor.DoorLocation; } } bool hidden = false; while (!hidden) { int rand = this.random.Next(this.myLocation.Exits.Length); this.myLocation = this.myLocation.Exits[rand]; if (this.myLocation is IHidingPlace) { hidden = true; } } }
void MoveToANewLocation(Location newLocation) { currentLocation = newLocation; exits.Items.Clear(); for (int i = 0; i < this.currentLocation.Exits.Length; i++) { exits.Items.Add(this.currentLocation.Exits[i].Name); exits.SelectedIndex = 0; } description.Text = currentLocation.Description; if (currentLocation is IHasExteriorDoor) { goThroughTheDoor.Visible = true; } else { goThroughTheDoor.Visible = false; } if (this.currentLocation is IHidingPlace) { this.check.Visible = true; } else { this.check.Visible = false; } this.RedrawForm(); }
public Opponent(Location startingLocation) { myLocation = startingLocation; this.random = new Random(); }