A little Lamda to reduce code a bit.
This commit is contained in:
parent
a403b24a05
commit
fde86e4792
1 changed files with 14 additions and 12 deletions
|
@ -160,13 +160,14 @@ namespace MudEngine.GameObjects.Environment
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Boolean DoorwayExist(AvailableTravelDirections travelDirection)
|
public Boolean DoorwayExist(AvailableTravelDirections travelDirection)
|
||||||
{
|
{
|
||||||
foreach (Door door in Doorways)
|
return Doorways.Exists(d => d.TravelDirection == travelDirection);
|
||||||
{
|
//foreach (Door door in Doorways)
|
||||||
if (door.TravelDirection == travelDirection)
|
//{
|
||||||
return true;
|
// if (door.TravelDirection == travelDirection)
|
||||||
}
|
// return true;
|
||||||
|
//}
|
||||||
|
|
||||||
return false;
|
//return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -176,12 +177,13 @@ namespace MudEngine.GameObjects.Environment
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Door GetDoor(AvailableTravelDirections travelDirection)
|
public Door GetDoor(AvailableTravelDirections travelDirection)
|
||||||
{
|
{
|
||||||
foreach (Door door in this.Doorways)
|
return Doorways.First(d => d.TravelDirection == travelDirection);
|
||||||
{
|
//foreach (Door door in this.Doorways)
|
||||||
if (door.TravelDirection == travelDirection)
|
//{
|
||||||
return door;
|
// if (door.TravelDirection == travelDirection)
|
||||||
}
|
// return door;
|
||||||
return null;
|
//}
|
||||||
|
//return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue