public static double ChebyshevDistance(MapObject obj, MapPosition position) { return(Math.Max(Math.Min(Math.Max(Math.Abs(obj.Position.X + obj.Size.Width - position.X), 0), Math.Max(Math.Abs(obj.Position.X - position.X), 0)), Math.Min(Math.Max(Math.Abs(obj.Position.Y + obj.Size.Height - position.Y), 0), Math.Max(Math.Abs(obj.Position.Y - position.Y), 0)))); }
public RectangleMapArea(MapPosition position, MapSize size) { Position = position; Size = size; }
public override bool IsInArea(MapPosition position) { return(MapDistanceProvider.ChebyshevDistance(Center, position) < Distance); }
public abstract bool IsInArea(MapPosition position);
public EmptyBlock(MapPosition position) { Position = position; ForestCoverRate = GameRandom.Current.RandomGameValue( ); }