コード例 #1
0
ファイル: PhysicsModule.cs プロジェクト: strager/SpermGame
        public static void Update(EntityCollection entities)
        {
            // The state of collisions (positions, etc.) may change between
            // iterations of FindCollisions.  To make this clear, we've opted
            // for a callback function instead of an IEnumerable return value
            // to indicate collisions.
            //
            // For example, four balls are colliding.  Each ball, after being
            // notified of a collision, moves itself so that it does not
            // collide with any of the other balls.
            //
            // If we collected collisions before-hand, handling them later, we
            // would fire 4*3 = 12 collision events.
            //
            // If we collected and handled collisions as they were detected, we
            // would fire at only three collisions.

            FindCollisions(entities.EntitiesWith<ICollidable>(), entities, Intersected);
        }