public CollidableAABB(ICollidable collidable)
 {
     Collidable = collidable;
     IsHardCollider = Collidable.IsHardCollidable;
     Points = new CollidablePoint[4];
     float top = Collidable.AABB.Top;
     float bottom = Collidable.AABB.Bottom();
     float left = Collidable.AABB.Left;
     float right = Collidable.AABB.Right();
     Points[0] = new CollidablePoint(CollidablePointIndex.TopLeft, new Vector2f(left, top), this);
     Points[1] = new CollidablePoint(CollidablePointIndex.TopRight, new Vector2f(right, top), this);
     Points[2] = new CollidablePoint(CollidablePointIndex.BottomRight, new Vector2f(right, bottom), this);
     Points[3] = new CollidablePoint(CollidablePointIndex.BottomLeft, new Vector2f(left, bottom), this);
 }
 /// <summary>
 /// Removes a CollidablePoint from this bucket, if it exists.
 /// </summary>
 /// <param name="point"></param>
 public void RemovePoint(CollidablePoint point)
 {
     if (_points.Contains(point))
         _points.Remove(point);
 }
 /// <summary>
 /// Adds a CollidablePoint to this bucket
 /// </summary>
 /// <param name="point"></param>
 public void AddPoint(CollidablePoint point)
 {
     _points.Add(point);
 }
 /// <summary>
 /// Removes an AABB point from a bucket
 /// </summary>
 /// <param name="point"></param>
 private void RemovePoint(CollidablePoint point)
 {
     CollidableBucket b = GetBucket(point.Coordinates);
     b.RemovePoint(point);
 }
示例#5
0
 /// <summary>
 /// Adds a CollidablePoint to this bucket
 /// </summary>
 /// <param name="point"></param>
 public void AddPoint(CollidablePoint point)
 {
     _points.Add(point);
 }
示例#6
0
        /// <summary>
        /// Removes an AABB point from a bucket
        /// </summary>
        /// <param name="point"></param>
        private void RemovePoint(CollidablePoint point)
        {
            CollidableBucket b = GetBucket(point.Coordinates);

            b.RemovePoint(point);
        }