示例#1
0
        private static void VoxelOperationRamp_Implementation(long entityId, MyRampShapeParams shapeParams, OperationType Type)
        {
            m_rampShape.Transformation = shapeParams.Transformation;
            m_rampShape.Boundaries.Max = shapeParams.Box.Max;
            m_rampShape.Boundaries.Min = shapeParams.Box.Min;
            m_rampShape.RampNormal     = shapeParams.RampNormal;
            m_rampShape.RampNormalW    = shapeParams.RampNormalW;

            if (CanPlaceInArea(Type, m_rampShape))
            {
                MyEntity entity;
                MyEntities.TryGetEntityById(entityId, out entity);
                MyVoxelBase voxel = entity as MyVoxelBase;
                if (voxel != null)
                {
                    voxel.BeforeContentChanged = true;
                    MyMultiplayer.RaiseEvent(voxel.RootVoxel, x => x.PerformVoxelOperationRamp_Implementation, shapeParams, Type);
                    var amountChanged = voxel.UpdateVoxelShape(Type, m_rampShape, shapeParams.Material);
                    if (Type == OperationType.Cut || Type == OperationType.Fill)
                    {
                        MySession.Static.VoxelHandVolumeChanged += amountChanged;
                    }
                }
            }
        }
示例#2
0
 private static void VoxelOperationElipsoid_Implementation(long entityId, Vector3 radius, MatrixD Transformation, byte material, OperationType Type)
 {
     m_ellipsoidShape.Transformation = Transformation;
     m_ellipsoidShape.Radius         = radius;
     if (CanPlaceInArea(Type, m_ellipsoidShape))
     {
         MyEntity entity;
         MyEntities.TryGetEntityById(entityId, out entity);
         MyVoxelBase voxel = entity as MyVoxelBase;
         if (voxel != null)
         {
             voxel.BeforeContentChanged = true;
             MyMultiplayer.RaiseEvent(voxel.RootVoxel, x => x.PerformVoxelOperationElipsoid_Implementation, radius, Transformation, material, Type);
             var amountChanged = voxel.UpdateVoxelShape(Type, m_ellipsoidShape, material);
             if (Type == OperationType.Cut || Type == OperationType.Fill)
             {
                 MySession.Static.VoxelHandVolumeChanged += amountChanged;
             }
         }
     }
 }
示例#3
0
        static void VoxelOperationSphere_Implementation(long entityId, Vector3D center, float radius, byte material, OperationType Type)
        {
            m_sphereShape.Center = center;
            m_sphereShape.Radius = radius;

            if (CanPlaceInArea(Type, m_sphereShape))
            {
                MyEntity entity;
                MyEntities.TryGetEntityById(entityId, out entity);
                MyVoxelBase voxel = entity as MyVoxelBase;
                if (voxel != null)
                {
                    voxel.BeforeContentChanged = true;
                    MyMultiplayer.RaiseEvent(voxel, x => x.PerformVoxelOperationSphere_Implementation, center, radius, material, Type);
                    var amountChanged = voxel.UpdateVoxelShape(Type, m_sphereShape, material);
                    if (Type == OperationType.Cut || Type == OperationType.Fill)
                    {
                        MySession.Static.VoxelHandVolumeChanged += amountChanged;
                    }
                }
            }
        }
示例#4
0
        private static void VoxelOperationBox_Implementation(long entityId, BoundingBoxD box, MatrixD Transformation, byte material, OperationType Type)
        {
            m_boxShape.Transformation = Transformation;
            m_boxShape.Boundaries.Max = box.Max;
            m_boxShape.Boundaries.Min = box.Min;

            if (CanPlaceInArea(Type, m_boxShape))
            {
                MyEntity entity;
                MyEntities.TryGetEntityById(entityId, out entity);
                MyVoxelBase voxel = entity as MyVoxelBase;
                if (voxel != null)
                {
                    voxel.BeforeContentChanged = true;
                    MyMultiplayer.RaiseEvent(voxel.RootVoxel, x => x.PerformVoxelOperationBox_Implementation, box, Transformation, material, Type);
                    var amountChanged = voxel.UpdateVoxelShape(Type, m_boxShape, material);
                    if (Type == OperationType.Cut || Type == OperationType.Fill)
                    {
                        MySession.Static.VoxelHandVolumeChanged += amountChanged;
                    }
                }
            }
        }
示例#5
0
        private static void VoxelOperationCapsule_Implementation(long entityId, MyCapsuleShapeParams capsuleParams, OperationType Type)
        {
            m_capsuleShape.Transformation = capsuleParams.Transformation;
            m_capsuleShape.A      = capsuleParams.A;
            m_capsuleShape.B      = capsuleParams.B;
            m_capsuleShape.Radius = capsuleParams.Radius;

            if (CanPlaceInArea(Type, m_capsuleShape))
            {
                MyEntity entity;
                MyEntities.TryGetEntityById(entityId, out entity);
                MyVoxelBase voxel = entity as MyVoxelBase;
                if (voxel != null)
                {
                    voxel.BeforeContentChanged = true;
                    MyMultiplayer.RaiseEvent(voxel.RootVoxel, x => x.PerformVoxelOperationCapsule_Implementation, capsuleParams, Type);
                    var amountChanged = voxel.UpdateVoxelShape(Type, m_capsuleShape, capsuleParams.Material);
                    if (Type == OperationType.Cut || Type == OperationType.Fill)
                    {
                        MySession.Static.VoxelHandVolumeChanged += amountChanged;
                    }
                }
            }
        }