示例#1
0
        /// <summary>
        /// Checks if given player has any non-flying unit in the zone.
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public bool IsIslandFor(Player player)
        {
            foreach (var unit in player.Units)
            {
                if (unit.UnitType.IsFlyer || unit.Position.IsInvalid)
                {
                    continue;
                }

                var walkPos = WalkPosition.Rescale(unit.Position);

                if (analyser.WalkGrid[walkPos.X, walkPos.Y].Zone == Id)
                {
                    return(false);
                }
            }

            return(true);
        }
 public static Position ToPixelTile(this WalkPosition p) =>
 new Position(p.X * PixelsInWalkTile, p.Y * PixelsInWalkTile);
示例#3
0
 public static bool Move(this Unit unit, WalkPosition position)
 {
     return(unit.Move(Position.Rescale(position), false));
 }
 public static TilePosition ToBuildTile(this WalkPosition p) =>
 new TilePosition(p.X / WalkTilesInBuildTile, p.Y / WalkTilesInBuildTile);