public void Setup() { TheWorld = new World(); // Create a 3 x 3 room // which is really a 4 x 4 because the walls occupy // a single square unit a piece. var floorPlan = Room.CreateEmptyRoom(5, 5); floorPlan[2][2] = new EntryPoint(); floorPlan[1][2] = new ExitPoint(); TheRoom = TheWorld.CreateRoom(floorPlan); TheWarrior = TheWorld.CreateWarrior(); TheWorld.EnterRoom(TheWarrior, TheRoom); Context(); Because(); }
/// <summary> /// Removes entity from the object it is currently occupying. /// </summary> /// <param name="TheWarrior"></param> internal void Remove(Warrior TheWarrior) { var coordinates = GetCoordinatesOf(TheWarrior); var roomUnit = GetUnitAt(coordinates); roomUnit.Entity = null; }
public Warrior CreateWarrior() { var warrior = new Warrior(this); _AddToEntities(warrior); return warrior; }
public IEntity Feel(RelativeDirections relativeDirection, Warrior TheWarrior, Room TheRoom) { var location = _GetCurrentLocation(TheWarrior, TheRoom); var direction = _ComputeAbsoluteDirection(TheWarrior, relativeDirection); var entity = _GetEntityAt(TheRoom, location, direction, 1); return entity; }
public void ExitRoom(Warrior TheWarrior, Room TheRoom) { var currentCoordinates = TheRoom.GetCoordinatesOf(TheWarrior); var currentUnit = TheRoom.GetUnitAt(currentCoordinates); if (currentUnit is ExitPoint) { TheRoom.Remove(TheWarrior); } }