public static void Update() { // update carving tool if (m_Enabled && IsAnyEditorActive()) { m_timeFromLastShaping += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS; // If we pressed LMB and collision of voxel hand shape with voxel map occurs, apply voxel hand shape to voxelMap if (m_applyToVoxelMap != null) { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("if (m_applyToVoxelMap != null)"); // New voxel hand shape object needs to be created, because otherwise all voxel hand shapes will point to same reference // Perform action MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("new MyEditorActionVoxelHand"); MyEditorActionVoxelHand voxelHandAction = new MyEditorActionVoxelHand(m_applyToVoxelMap, VoxelHandShape.CreateCopy()); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("voxelHandAction.RegisterAndDoAction()"); voxelHandAction.RegisterAndDoAction(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); // Immediately remove voxel map reference, so that only one hand shape is created at one LMB click m_applyToVoxelMap = null; MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); } } }
public static void Update() { // update carving tool if (m_Enabled && IsAnyEditorActive()) { m_timeFromLastShaping += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS; // If we pressed LMB and collision of voxel hand shape with voxel map occurs, apply voxel hand shape to voxelMap if (m_applyToVoxelMap != null) { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("if (m_applyToVoxelMap != null)"); // New voxel hand shape object needs to be created, because otherwise all voxel hand shapes will point to same reference // Perform action MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("new MyEditorActionVoxelHand"); MyEditorActionVoxelHand voxelHandAction = new MyEditorActionVoxelHand(m_applyToVoxelMap, VoxelHandShape.CreateCopy()); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("voxelHandAction.RegisterAndDoAction()"); voxelHandAction.RegisterAndDoAction(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); // Immediately remove voxel map reference, so that only one hand shape is created at one LMB click m_applyToVoxelMap = null; MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); } } }