コード例 #1
0
 public void CheckForNewIntersection(Collider other)
 {
     if (!IntersectingColliders.Contains(other) && shape.Intersects(other.shape))
     {
         OnCollisionEnter?.Invoke(this, new Collision()
         {
             Caller = this, otherCollider = other
         });
     }
 }
コード例 #2
0
 public bool Intersects(IShape2D other, bool doubledsided = true)
 {
     if (other is Rect rectangle)
     {
         return(this.Intersects(rectangle));
     }
     else if (doubledsided)
     {
         return(other.Intersects(this, false));
     }
     else
     {
         throw new ArgumentException();
     }
 }