예제 #1
0
        public MyPhysics()
        {
            physicsSystem = this;

            m_RigidBodyModule = new MyRigidBodyModule();
            m_SensorModule = new MySensorModule();
            m_ContactConstraintModule = new MyContactConstraintModule();

            m_SensorInteractionModule = new MySensorInteractionModule();            

            m_RBInteractionModule = new MyRBInteractionModule();
            m_Utils = new MyPhysicsUtils();

            m_PhysicsObjects = new MyPhysicsObjects();

            m_SimulationHandlers = new List<MyPhysSimulationHandler>(16);
        }
예제 #2
0
        public override void LoadData()
        {
            MyMwcLog.WriteLine("MyGuiScreenGamePlay.LoadData - START");
            MyMwcLog.IncreaseIndent();

            m_multipleLoadsCount++;

            int loadDataBlock = -1;
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyGuiScreenGamePlay.LoadData", ref loadDataBlock);

            MyPerformanceTimer.GuiScreenGamePlay_LoadData.Start();

            Static = this;

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MySunGlare.UpdateSectorInfo");
            MySunGlare.UpdateSectorInfo();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyGuiScreenGamePlay.InitSounds");

            InitSounds();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyGuiScreenGamePlay.MyHudSectorBorder block");
            MyHudSectorBorder.LoadData();
            MyDistantImpostors.LoadData();
            MyLights.LoadData();
            MyExplosions.LoadData();
            MyProjectiles.LoadData();
            MyCockpitGlassDecals.LoadData();
            MyModels.LoadData();

            if (IsEditorActive())
            {
                MyGuiManager.LoadPrefabPreviews();
            }
            MyTransparentGeometry.LoadData();
            MyParticlesDustField.LoadData();
            MyHud.LoadData();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyGuiScreenGamePlay.MyVoxelMaterials block");
            MyVoxelMaterials.LoadData();

            MyVoxelGenerator.LoadData();
            MyDebrisField.LoadData();

            MyVoxelContentCellContents.LoadData();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyGuiScreenGamePlay.MyVoxelCacheData block");
            MyVoxelCacheData.LoadData();
            MyVoxelCacheCellRenderHelper.LoadData();
            MyVoxelCacheRender.LoadData();
            MyVoxelPrecalc.LoadData();
            MyVoxelMaps.LoadData();

            MyWayPointGraph.LoadData();

            MyPhysics physics = new MyPhysics();
            physics.InitializePhysics();
            MyConstants.InitializeCollisionLayers();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("MyGuiScreenGamePlay.MyAmmoConstants block");
            MyAmmoConstants.LoadData();

            MyEntities.LoadData();

            MyMissiles.LoadData();
            MyHologramShips.LoadData();
            MyCannonShots.LoadData();
            MyUniversalLauncherShells.LoadData(true);
            MyExplosionDebrisVoxel.LoadData();
            MyExplosionDebrisModel.LoadData();

            MyEditor.Static.LoadData();
            MyFriendlyFire.Load();

            if (MyFakes.ENABLE_SHOUT)
            {
                MyShouts.LoadData();
            }

            // load editor controls also when game active, because we can enter editor during gameplay
            if (IsEditorActive() || IsGameActive())
            {
                EditorControls.LoadData();
                //FoundationFactoryControls.LoadData();
            }

            m_invokeGameEditorSwitch = false;
            m_lastTimeSwitchedDroneControl = MyConstants.FAREST_TIME_IN_PAST;

            MyPerformanceTimer.GuiScreenGamePlay_LoadData.End();

            PartialDustColor = new List<Vector4>();

            m_notificationYouHaveToBeNearMothership = new MyHudNotification.MyNotification(MyTextsWrapperEnum.NotificationYouHaveToBeNearMothership, MyGuiManager.GetFontMinerWarsRed(), (int)TimeSpan.FromSeconds(5).TotalMilliseconds);
            m_notificationUnableToLeaveSectorMission = new MyHudNotification.MyNotification(MyTextsWrapperEnum.UnableToLeaveSectorMission, MyGuiManager.GetFontMinerWarsRed(), (int)TimeSpan.FromSeconds(5).TotalMilliseconds);

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(loadDataBlock);

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyGuiScreenGamePlay.LoadData - END");
        }
예제 #3
0
        public void DestroyPhysics()
        {
            m_SensorModule.Destroy();
            m_SensorModule = null;

            m_RigidBodyModule.Destroy();
            m_RigidBodyModule = null;

            m_RBInteractionModule.Destroy();
            m_RBInteractionModule = null;

            m_ContactConstraintModule.Destroy();
            m_ContactConstraintModule = null;
            m_SimulationHandlers.Clear();
            m_SimulationHandlers = null;

            physicsSystem = null;            
            
            
            m_SensorInteractionModule = null;
            
            m_Utils = null;
            m_PhysicsObjects = null;
        }