Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 protected Piece()
 {
     Id          = Guid.NewGuid();
     CurrentLand = null;
 }
Esempio n. 3
0
        private bool IsClimbingMoreThen1LevelUp(Land from, Land to)
        {
            var levelDiff = to.LandLevel - from.LandLevel;

            return(levelDiff > 1);
        }
Esempio n. 4
0
 private bool IsLandBlocked(Land land)
 => CurrentLand.Equals(land) ||
 land.HasWorker ||
 land.MaxLevelReached;
Esempio n. 5
0
 private bool IsSteppingUp(Land from, Land to)
 => to.LandLevel > from.LandLevel;