Exemplo n.º 1
0
        //  When tube is ejecting and looking for voxels
        void StartFindingVoxel()
        {
            //  Else we normally start ejecting
            CurrentState        = MyHarvestingDeviceEnum.FindingVoxel;
            m_headPositionLocal = Vector3.Zero;
            StartTubeMovingCue();
            StopGrindingCue();

            if (m_light != null)
            {
                MyLights.RemoveLight(m_light);
            }
            m_light = null;

            //m_light = MyLights.AddLight();

            if (m_light != null)
            {
                var color = 5 * new Vector4(1, 0.3f, 0.3f, 1);
                m_light.Start(MyLight.LightTypeEnum.PointLight, color, 3, 10);
            }

            MyScriptWrapper.HarvesterUse();
            UpdateAfterSimulation();
        }
Exemplo n.º 2
0
 //  When tube didn't find voxels so it's pulling back
 void StartReturningBack()
 {
     //  Head was in voxels, so we return it back to the ship
     CurrentState = MyHarvestingDeviceEnum.ReturningBack;
     m_parentMinerShip.Physics.Immovable = false;
     StopGrindingCue();
     StartTubeMovingCue();
     CloseEffect();
 }
Exemplo n.º 3
0
 //  When tube collided with something so we must pull it back quickly, so player won't notice intersection
 void StartFastReturningBack()
 {
     CurrentState = MyHarvestingDeviceEnum.FastReturningBack;
     m_parentMinerShip.Physics.Immovable = false;
     MyAudio.AddCue2dOr3d(Parent, MySoundCuesEnum.VehHarvesterTubeCollision2d,
                          Parent.GetPosition(), Parent.WorldMatrix.Forward, Parent.WorldMatrix.Up, Parent.Physics.LinearVelocity);
     StopGrindingCue();
     StopTubeMovingCue();
     CloseEffect();
 }
Exemplo n.º 4
0
        //  When tube is inside miner ship, default status
        void StartInsideShip()
        {
            CurrentState = MyHarvestingDeviceEnum.InsideShip;
            StopTubeMovingCue();

            if (m_light != null)
            {
                MyLights.RemoveLight(m_light);
            }
            m_light = null;
        }
Exemplo n.º 5
0
        //  When tube/head mounted into voxels and is harvesting
        void StartInVoxel(MyVoxelMap voxelMap)
        {
            //  We found voxel so we stop here
            m_inVoxelMap = voxelMap;
            CurrentState = MyHarvestingDeviceEnum.InVoxel;
            StopTubeMovingCue();
            StartGrindingCue();
            m_lastTimeParticleAdded = null;
            m_parentMinerShip.Physics.Clear();
            m_parentMinerShip.Physics.Immovable = true;

            MyMwcVector3Int tempVoxelCoord = voxelMap.GetVoxelCenterCoordinateFromMeters(ref m_headPositionTransformed);

            m_originalVoxelContent = voxelMap.GetVoxelContent(ref tempVoxelCoord);
            m_voxelMaterial        = voxelMap.GetVoxelMaterial(ref tempVoxelCoord);


            m_harvestingParticleEffect = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Harvester_Harvesting);
            m_harvestingParticleEffect.UserBirthMultiplier  = 0.25f;
            m_harvestingParticleEffect.UserRadiusMultiplier = 1;
            m_harvestingParticleEffect.UserColorMultiplier  = new Vector4(3, 3, 3, 3);
            Matrix dirMatrix = MyMath.MatrixFromDir(WorldMatrix.Forward);

            m_harvestingParticleEffect.WorldMatrix = Matrix.CreateWorld(m_headPositionTransformed, dirMatrix.Forward, dirMatrix.Up);

            //  Empty voxels are problematic and can lead to "extremely fast harvesting". So here we do this
            //  trick and its effect will be that even empty voxels will take few seconds to harvest.
            if (m_originalVoxelContent == 0)
            {
                m_originalVoxelContent = 1;
            }

            m_actualVoxelContent = (float)m_originalVoxelContent;
            m_harvestingSpeed    = m_actualVoxelContent / TIME_TO_HARVEST_WHOLE_VOXEL_IN_UPDATE_TIMES;

            if (!MyVoxelMapOreMaterials.CanBeHarvested(m_voxelMaterial))
            {
                HUD.MyHud.ShowIndestructableAsteroidNotification();
                StartReturningBack();
            }
        }
Exemplo n.º 6
0
        //  When tube is inside miner ship, default status
        void StartInsideShip()
        {
            CurrentState = MyHarvestingDeviceEnum.InsideShip;
            StopTubeMovingCue();

            if (m_light != null) MyLights.RemoveLight(m_light);
            m_light = null;
        }
Exemplo n.º 7
0
 //  When tube collided with something so we must pull it back quickly, so player won't notice intersection
 void StartFastReturningBack()
 {
     CurrentState = MyHarvestingDeviceEnum.FastReturningBack;
     m_parentMinerShip.Physics.Immovable = false;
     MyAudio.AddCue2dOr3d(Parent, MySoundCuesEnum.VehHarvesterTubeCollision2d,
         Parent.GetPosition(), Parent.WorldMatrix.Forward, Parent.WorldMatrix.Up, Parent.Physics.LinearVelocity);
     StopGrindingCue();
     StopTubeMovingCue();
     CloseEffect();
 }
Exemplo n.º 8
0
 //  When tube didn't find voxels so it's pulling back
 void StartReturningBack()
 {
     //  Head was in voxels, so we return it back to the ship
     CurrentState = MyHarvestingDeviceEnum.ReturningBack;
     m_parentMinerShip.Physics.Immovable = false;
     StopGrindingCue();
     StartTubeMovingCue();
     CloseEffect();
 }
Exemplo n.º 9
0
        //  When tube/head mounted into voxels and is harvesting
        void StartInVoxel(MyVoxelMap voxelMap)
        {
            //  We found voxel so we stop here
            m_inVoxelMap = voxelMap;
            CurrentState = MyHarvestingDeviceEnum.InVoxel;
            StopTubeMovingCue();
            StartGrindingCue();
            m_lastTimeParticleAdded = null;
            m_parentMinerShip.Physics.Clear();
            m_parentMinerShip.Physics.Immovable = true;

            MyMwcVector3Int tempVoxelCoord = voxelMap.GetVoxelCenterCoordinateFromMeters(ref m_headPositionTransformed);
            m_originalVoxelContent = voxelMap.GetVoxelContent(ref tempVoxelCoord);
            m_voxelMaterial = voxelMap.GetVoxelMaterial(ref tempVoxelCoord);


            m_harvestingParticleEffect = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Harvester_Harvesting);
            m_harvestingParticleEffect.UserBirthMultiplier = 0.25f;
            m_harvestingParticleEffect.UserRadiusMultiplier = 1;
            m_harvestingParticleEffect.UserColorMultiplier = new Vector4(3, 3, 3, 3);
            Matrix dirMatrix = MyMath.MatrixFromDir(WorldMatrix.Forward);
            m_harvestingParticleEffect.WorldMatrix = Matrix.CreateWorld(m_headPositionTransformed, dirMatrix.Forward, dirMatrix.Up);

            //  Empty voxels are problematic and can lead to "extremely fast harvesting". So here we do this
            //  trick and its effect will be that even empty voxels will take few seconds to harvest.
            if (m_originalVoxelContent == 0) m_originalVoxelContent = 1;

            m_actualVoxelContent = (float)m_originalVoxelContent;
            m_harvestingSpeed = m_actualVoxelContent / TIME_TO_HARVEST_WHOLE_VOXEL_IN_UPDATE_TIMES;

            if (!MyVoxelMapOreMaterials.CanBeHarvested(m_voxelMaterial))
            {
                HUD.MyHud.ShowIndestructableAsteroidNotification();
                StartReturningBack();
            }
        }
Exemplo n.º 10
0
        //  When tube is ejecting and looking for voxels
        void StartFindingVoxel()
        {
            //  Else we normally start ejecting
            CurrentState = MyHarvestingDeviceEnum.FindingVoxel;
            m_headPositionLocal = Vector3.Zero;
            StartTubeMovingCue();
            StopGrindingCue();

            if (m_light != null)
                MyLights.RemoveLight(m_light);
            m_light = null;

            //m_light = MyLights.AddLight();

            if (m_light != null)
            {
                var color = 5 * new Vector4(1, 0.3f, 0.3f, 1);
                m_light.Start(MyLight.LightTypeEnum.PointLight, color, 3, 10);
            }

            MyScriptWrapper.HarvesterUse();
            UpdateAfterSimulation();
        }