MudEngine:
- Player movement command now fully implemented. - Game.GetRealm() added to retrieve a Realm within the games RealmCollection property - Game.End() added to perform game ending duties and shut down the Server - Server now loses opened threads. - Player.Move() added to move the player from Room to Room. - Room.DoorwayExist() tweaked to work with the new way Environments are managed. MudGame: - Now executes the Look command on startup so the player can see where they are located at. - Implements the new Game.End() method and fixes the game hanging upon exit.
This commit is contained in:
parent
19e3ec0936
commit
70533582a6
7 changed files with 57 additions and 10 deletions
|
@ -42,13 +42,31 @@ namespace MudEngine.GameObjects.Characters
|
|||
CurrentRoom = game.InitialRealm.InitialZone.InitialRoom;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the player from one Room to another if the supplied direction contains a doorway.
|
||||
/// Returns false if no doorway is available.
|
||||
/// </summary>
|
||||
/// <param name="travelDirection"></param>
|
||||
/// <returns></returns>
|
||||
public bool Move(AvailableTravelDirections travelDirection)
|
||||
{
|
||||
//Check if the current room has a doorway in the supplied direction of travel.
|
||||
if (!CurrentRoom.DoorwayExist(travelDirection))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//We have a doorway, lets move to the next room.
|
||||
CurrentRoom = Game.GetRealm(CurrentRoom.Realm).GetZone(CurrentRoom.Zone).GetRoom(CurrentRoom.GetDoor(travelDirection).ConnectedRoom);
|
||||
|
||||
OnTravel(travelDirection);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void OnTravel(AvailableTravelDirections travelDirection)
|
||||
{
|
||||
if (CurrentRoom.DoorwayExist(travelDirection.ToString()))
|
||||
{
|
||||
string connectedRoom = CurrentRoom.GetDoor(travelDirection).ConnectedRoom;
|
||||
CurrentRoom = (Room)CurrentRoom.Load(connectedRoom);
|
||||
}
|
||||
//TODO: Check the Room/Zone/Realm to see if anything needs to occure during travel.
|
||||
}
|
||||
|
||||
public CommandResults ExecuteCommand(string command)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue