Esempio n. 1
0
        private void ProcessCollisionsRecursive(IList <GameObject> layer, GameObject caller)
        {
            for (int x = 0; x < layer.Count; x++)
            {
                GameObject node = layer[x];
                //Don't check for collisions with noclip objectws or with the object you are checking
                if (!node.NoClip && !caller.NoClip && node != caller)
                {
                    if (node.Intersects(caller))
                    {
                        caller.OnObjectCollision(node);
                        //TODO: Should we call OnCollision For both objects? (both fireballs should explode)
                    }
                }

                ProcessCollisionsRecursive(node.Children, caller);
            }
        }
Esempio n. 2
0
        private void ProcessCollisionsRecursive(IList<GameObject> layer, GameObject caller)
        {
            for (int x = 0; x < layer.Count; x++)
            {
                GameObject node = layer[x];
                //Don't check for collisions with noclip objectws or with the object you are checking
                if (!node.NoClip && !caller.NoClip && node != caller)
                {
                    if (node.Intersects(caller))
                    {
                        caller.OnObjectCollision(node);
                        //TODO: Should we call OnCollision For both objects? (both fireballs should explode)
                    }
                }

                ProcessCollisionsRecursive(node.Children, caller);
            }
        }