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