public bool Check(Location locationToCheck) { if (locationToCheck != myLocation) return false; else return true; }
public bool Check(Location location) { if (myLocation == location) return true; else return false; }
public 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.Exits.Length); myLocation = myLocation.Exits[rand]; if (myLocation is IHidingPlace) hidden = true; } }
public void Move() { if(myLocation is IHasExteriorDoor) { IHasExteriorDoor LocationHasDoor = myLocation as IHasExteriorDoor; if (random.Next(2) == 1) myLocation = LocationHasDoor.DoorLocation; } bool hidingPLace = false; while (!hidingPLace) { int index = random.Next(myLocation.Exits.Length); myLocation = myLocation.Exits[index]; if (myLocation is IHidingPlace) hidingPLace = true; } }
private void MoveToANewLocation(Location newLocation) { Moves++; currentLocation = newLocation; RedrawForm(); }
public Opponent(Location startingLocation) { myLocation = startingLocation; random = new Random(); }