/// <summary> /// Ermittelt, ob eine Rechtsbewegung möglich ist. /// </summary> /// <param name="door">Die zu testende Tür</param> /// <returns><c>true</c>, wenn Rechtsbewegung möglich, ansonsten <c>false</c></returns> public bool CanTurnRight(Door4 door) { switch (Direction) { case Door4.North: return door.ContainsDoor(Door4.East); case Door4.South: return door.ContainsDoor(Door4.West); case Door4.East: return door.ContainsDoor(Door4.South); case Door4.West: return door.ContainsDoor(Door4.North); default: throw new InvalidOperationException("Ungültiger Zustand: " + Direction); } }
/// <summary> /// Ermittelt, ob eine Vorwärtsbewegung möglich ist. /// </summary> /// <param name="door">Die zu testende Tür</param> /// <returns><c>true</c>, wenn Vorwärtsbewegung möglich, ansonsten <c>false</c></returns> public bool CanMoveForward(Door4 door) { return door.ContainsDoor(Direction); }