示例#1
0
 /// <summary>
 /// Checks for intersection between two BoundingCircles and returns a Vector for a potential colliding position.
 /// </summary>
 public bool Intersects(BoundingCircle other, out Vector2? intersectionPosition)
 {
     intersectionPosition = null;
     if (Vector2.DistanceSquared(other.Entity.Position, Entity.Position) <= (other.Radius + Radius) * (other.Radius + Radius))
     {
         Vector2 colDir = other.Entity.Position - Entity.Position; ;
         colDir.Normalize();
         intersectionPosition = Entity.Position + colDir * Radius;
         return true;
     }
     return false;
 }
示例#2
0
 /// <summary>
 /// Checks for intersection between two BoundingCircles.
 /// </summary>
 public bool Intersects(BoundingCircle other)
 {
     return Vector2.DistanceSquared(other.Entity.Position, Entity.Position) <= (other.Radius + Radius) * (other.Radius + Radius);
 }
示例#3
0
 public Radar (GameShip ship, float radius)
 {
     this.Bounding = new BoundingCircle(ship, radius);
 }