/// <summary>
        /// Creates a new instance of Collidable.
        /// </summary>
        /// <param name="bounds">Initial bounds for the Collidable.</param>
        public Collidable(Bounds2d bounds)
        {
            _disposed = 0;

            Bounds = bounds;
            ID = Interlocked.Increment(ref _collidableIDs);

            // Set a default collision event so we don't have to check if its null
            OnCollision = obj => { };
            OnDisposed = obj => { };
        }
示例#2
0
 /// <summary>
 /// Determines if the current bounded object intersects another bounded object.
 /// </summary>
 /// <param name="obj">Bounding object to check collision with.</param>
 /// <returns>Whether the bounds intersects the object.</returns>
 public override bool Intersects(Bounds2d obj)
 {
     return(obj.Intersects(this));
 }
示例#3
0
 /// <summary>
 /// Determines if the current bounded object completely contains another bounded object.
 /// </summary>
 /// <param name="obj">A bounded object to check containment on.</param>
 /// <returns>Whether the bounds contains the object.</returns>
 public override bool Contains(Bounds2d obj)
 {
     return(this.Contains(obj));
 }
 /// <summary>
 /// Determines if the current bounded object intersects another bounded object.
 /// </summary>
 /// <param name="obj">Bounding object to check collision with.</param>
 /// <returns>Whether the bounds intersects the object.</returns>
 public override bool Intersects(Bounds2d obj)
 {
     return obj.Intersects(this);
 }
 /// <summary>
 /// Determines if the current bounded object completely contains another bounded object.
 /// </summary>
 /// <param name="obj">A bounded object to check containment on.</param>
 /// <returns>Whether the bounds contains the object.</returns>
 public override bool Contains(Bounds2d obj)
 {
     return this.Contains(obj);
 }
示例#6
0
 /// <summary>
 /// Determines if the current bounded object intersects another bounded object.
 /// </summary>
 /// <param name="obj">Bounding object to check collision with.</param>
 /// <returns>Whether the bounds intersects the object.</returns>
 public abstract bool Intersects(Bounds2d obj);
示例#7
0
 /// <summary>
 /// Determines if the current bounded object completely contains another bounded object.
 /// </summary>
 /// <param name="obj">A bounded object to check containment on.</param>
 /// <returns>Whether the bounds contains the object.</returns>
 public abstract bool Contains(Bounds2d obj);
示例#8
0
 /// <summary>
 /// Determines if the current bounded object intersects another bounded object.
 /// </summary>
 /// <param name="obj">Bounding object to check collision with.</param>
 /// <returns>Whether the bounds intersects the object.</returns>
 public abstract bool Intersects(Bounds2d obj);
示例#9
0
 /// <summary>
 /// Determines if the current bounded object completely contains another bounded object.
 /// </summary>
 /// <param name="obj">A bounded object to check containment on.</param>
 /// <returns>Whether the bounds contains the object.</returns>
 public abstract bool Contains(Bounds2d obj);
 /// <summary>
 /// Determines if the current BoundingCircle contains the provided bounded object.
 /// </summary>
 /// <param name="obj">A bounded object to check containment on.</param>
 /// <returns>Whether the BoundingCircle contains the object.</returns>
 public override bool Contains(Bounds2d obj)
 {
     return obj.Contains(this);
 }