示例#1
0
 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))));
 }
示例#2
0
 public RectangleMapArea(MapPosition position, MapSize size)
 {
     Position = position;
     Size     = size;
 }
示例#3
0
 public override bool IsInArea(MapPosition position)
 {
     return(MapDistanceProvider.ChebyshevDistance(Center, position) < Distance);
 }
示例#4
0
 public abstract bool IsInArea(MapPosition position);
示例#5
0
 public EmptyBlock(MapPosition position)
 {
     Position        = position;
     ForestCoverRate = GameRandom.Current.RandomGameValue( );
 }