Пример #1
0
        public static CollisionResult WithAtPos( string[] types, ICollider collider, float x, float y )
        {
            foreach (var type in types) {

                HashSet<ICollider> colliders;
                typeCache.TryGetValue(type, out colliders);

                if (colliders != null) {
                    foreach (var col in colliders) {
                        // @TODO check center distances for optimisation? or full quadtree?
                        if (col.isActive() && col != collider) {
                            var intersect = collider.Intersect(col, x, y);

                            if (intersect.Intersect && (intersect.MinimumTranslation.x != 0 || intersect.MinimumTranslation.y != 0) )
                            {
                                return intersect;
                            }
                        }
                    }
                }
            }

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