private bool CanBuildAt(int posX, int posY, out Land land) { if (CurrentLand.Island.TryGetLand(posX, posY, out land)) { if (IsLandBlocked(land)) { return(false); } var(posXDiff, posYDiff) = (Math.Abs(CurrentLand.Coord.X - land.Coord.X), Math.Abs(CurrentLand.Coord.Y - land.Coord.Y)); if (posXDiff > 1 || posYDiff > 1) { return(false); } return(true); } return(false); }
protected Piece() { Id = Guid.NewGuid(); CurrentLand = null; }
private bool IsClimbingMoreThen1LevelUp(Land from, Land to) { var levelDiff = to.LandLevel - from.LandLevel; return(levelDiff > 1); }
private bool IsLandBlocked(Land land) => CurrentLand.Equals(land) || land.HasWorker || land.MaxLevelReached;
private bool IsSteppingUp(Land from, Land to) => to.LandLevel > from.LandLevel;