示例#1
0
        /// <summary>
        /// Clears the collision grid and inserts all entities before checking collisions
        /// </summary>
        protected override void PreProcess()
        {
            _comparisons = 0;

            _map.Clear();
            var maxEntities = AssociatedEntities.Count;

            for (int e = 0; e < maxEntities; e++)
            {
                // Insert all entities with collision components
                if (AssociatedEntities[e].HasComponent <CollisionComponent>())
                {
                    var collision = AssociatedEntities[e].GetComponent <CollisionComponent>();
                    collision.Event    = false;
                    collision.Collider = null;
                    _map.Insert(AssociatedEntities[e], collision);
                }
            }
        }