예제 #1
0
        public bool HasCollision(ICollidablePrimitive other)
        {
            #region Argument Check

            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            #endregion

            var otherLine = other as LinePrimitive;
            if (otherLine != null)
            {
                return(CollisionDetector.CheckLineToLineCollision(this, otherLine));
            }

            var circle = other as CirclePrimitive;
            if (circle != null)
            {
                return(CollisionDetector.CheckLineToCircleCollision(this, circle));
            }

            var polygon = other as ConvexPolygonPrimitive;
            if (polygon != null)
            {
                return(CollisionDetector.CheckLineToPolygonCollision(this, polygon));
            }

            throw new NotSupportedException();
        }