muddesigner/MudEngine/World/Room.cs
Scionwest_cp a365256d53 Changes project wide with this check-in.
MudCompiler:
No longer works.  Needs to be re-wrote to support the new Alpha 2.0 engine

MudDesigenr:
Removed most of the forms since we are not working on it.  Only form left is Project Manager, which will be removed shortly as well.

MudGame:
No longer runs.  All of the source code was removed due to MudEngine Alpha 2.0 source changing drastically.

MudEngine:
Alpha 2.0 source code finally checked-in.  It contains the full re-build of the engine.  A lot of new abstract classes have been added.
2011-10-01 22:20:23 -07:00

84 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MudEngine.Core;
namespace MudEngine.World
{
public class Room : BaseEnvironment
{
/// <summary>
/// Gets or Sets the type of terrain that this room contains.
/// </summary>
public TerrainTypes Terrain { get; set; }
/// <summary>
/// Gets a reference to the collection of doorways present within this room
/// </summary>
public List<Door> Doorways { get; private set; }
public Room(BaseGame game) : base(game)
{
Doorways = new List<Door>();
}
/// <summary>
/// Installs a doorway into the room. Multiple doorways for the same travel direction is not allowed.
/// </summary>
/// <param name="door"></param>
/// <returns></returns>
public bool InstallDoor(Door door)
{
//Anonymous method to check if a door already exists for the travel direction supplied.
Door dr = Doorways.Find(delegate(Door d)
{
return d.TravelDirection == door.TravelDirection;
}
);
if (dr != null)
return false;
Doorways.Add(door);
return true;
}
/// <summary>
/// Removes a doorway from the room.
/// </summary>
/// <param name="travelDirection"></param>
public void RemoveDoor(AvailableTravelDirections travelDirection)
{
Door dr = Doorways.Find(delegate(Door d)
{
return d.TravelDirection == travelDirection;
}
);
if (dr != null)
Doorways.Remove(dr);
}
/// <summary>
/// Checks to see if a doorway exists for the supplied travel direction.
/// </summary>
/// <param name="travelDirection"></param>
/// <returns></returns>
public bool DoorwayExists(AvailableTravelDirections travelDirection)
{
return Doorways.Exists(d => d.TravelDirection == travelDirection);
}
/// <summary>
/// Returns a reference to an installed doorway, for the supplied travel direction.
/// </summary>
/// <param name="travelDirection"></param>
/// <returns></returns>
public Door GetDoorway(AvailableTravelDirections travelDirection)
{
return Doorways.Find(d => d.TravelDirection == travelDirection);
}
}
}