public bool Check(Location locationToCheck) { if (locationToCheck != myLocation) return false; else return true; }
public void Move() { bool hidden = false; while(!hidden) { if (myLocation is IHasExteriorDoor && random.Next(2) > 0) { IHasExteriorDoor hasDoor = myLocation as IHasExteriorDoor; myLocation = hasDoor.DoorLocation; } int randNumber = random.Next(myLocation.Exits.Length); myLocation = myLocation.Exits[randNumber]; if (myLocation is IHidingPlace) hidden = true; } }
public void Move() { bool hidden = false; while (!hidden) { if (myLocation is IHasExteriorDoor) { IHasExteriorDoor locationWithDoor = myLocation as IHasExteriorDoor; if (random.Next(2) == 1) myLocation = locationWithDoor.DoorLocation; } int rand = random.Next(myLocation.Exits.Length); myLocation = myLocation.Exits[rand]; if (myLocation is IHidingPlace) hidden = true; } }
private void MoveToANewLocation(Location location) { ++Moves; currentLocation = location; RedrawForm(); }
public bool Check(Location location) { return location == myLocation; }
public Opponent(Location location) { myLocation = location; random = new Random(); }
public Opponent(Location startingLocation) { myLocation = startingLocation; random = new Random(); }
private void MoveToANewLocation(Location newLocation) { Moves++; currentLocation = newLocation; RedrawForm(); }