Example #1
0
        public override CollisionResult Intersect(ICollider col, float speedX, float speedY)
        {
            if (col is Hitbox) {
                var res = IntersectHitbox(col as Hitbox, speedX, speedY);

                return new CollisionResult() {
                    Intersect = res.Intersect,
                    MinimumTranslation = res.MinimumTranslation,
                    Collider = col,
                    CollisionObject = col.GetGameObject()
                };
            }

            if (col is Polybox) {
                var res = IntersectPolybox(col as Polybox, speedX, speedY);

                return new CollisionResult() {
                    Intersect = res.Intersect || res.WillIntersect,
                    MinimumTranslation = res.MinimumTranslation,
                    Collider = col,
                    CollisionObject = col.GetGameObject()
                };
            }

            Logging.Log("Collision type not supported for", this, col);

            return new CollisionResult() {
                Intersect = false
            };
        }