Example #1
0
        /// <summary>
        /// Elimina gli oggetti che escono dal box degli oggetti
        /// </summary>
        private void DeleteObjectsOutOfBox()
        {
            IList <string> modelsToDelete = physicsGame.Components.Where(w => w.Value is IRigidBodyComponent && ((IRigidBodyComponent)w.Value).RigidBody.Position.Length() > boxRadius).Select(w => w.Key).ToList();

            for (int i = 0; i < modelsToDelete.Count; i++)
            {
                physicsGame.RemoveComponent(modelsToDelete[i]);
            }
        }