コード例 #1
0
        protected override MyMwcObjectBuilder_Base GetObjectBuilderInternal(bool getExactCopy)
        {
            MyMwcObjectBuilder_VoxelHand_Sphere objectBuilder = (MyMwcObjectBuilder_VoxelHand_Sphere)base.GetObjectBuilderInternal(getExactCopy);

            objectBuilder.Radius = this.Radius;
            return(objectBuilder);
        }
コード例 #2
0
        public static void LoadData()
        {
            // default shape is sphere
            MyMwcObjectBuilder_VoxelHand_Sphere defaultBuilder = new MyMwcObjectBuilder_VoxelHand_Sphere(new MyMwcPositionAndOrientation(MySpectator.Orientation, Vector3.Forward, Vector3.Up), MyVoxelConstants.DEFAULT_VOXEL_HAND_SIZE, MyMwcVoxelHandModeTypeEnum.SUBTRACT);

            VoxelHandShape = new MyVoxelHandSphere();
            ((MyVoxelHandSphere)VoxelHandShape).Init(defaultBuilder, null);

            m_Enabled              = false;
            m_timeFromLastShaping  = 0;
            m_distance             = MyVoxelConstants.DEFAULT_VOXEL_HAND_DISTANCE;
            IsProjected            = false;
            IsProjectedToWaypoints = false;
        }
コード例 #3
0
 public void Init(MyMwcObjectBuilder_VoxelHand_Sphere objectBuilder, MyVoxelMap parentVoxelMap)
 {
     base.Init(objectBuilder, parentVoxelMap);
     this.Radius = objectBuilder.Radius;
     UpdateLocalVolume();
 }
コード例 #4
0
 public void Init(MyMwcObjectBuilder_VoxelHand_Sphere objectBuilder, MyVoxelMap parentVoxelMap)
 {
     base.Init(objectBuilder, parentVoxelMap);
     this.Radius = objectBuilder.Radius;
     UpdateLocalVolume();
 }
コード例 #5
0
        public static void SetVoxelProperties(MyVoxelHandShapeType voxelHandShapeType, float distance, MyMwcVoxelHandModeTypeEnum modeType, MyMwcVoxelMaterialsEnum?materialEnum, bool isProjected, bool isProjectedToWaypoints)
        {
            IsProjected            = isProjected;
            IsProjectedToWaypoints = isProjectedToWaypoints;
            // same shape type
            if (voxelHandShapeType == MyEditorVoxelHand.VoxelHandShape.GetShapeType())
            {
                //if ((size >= MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (size <= MyVoxelConstants.MAX_VOXEL_HAND_SIZE))
                {
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize(size);
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize2(size2);
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize3(size3);
                    MyEditorVoxelHand.VoxelHandShape.ModeType = modeType;
                    MyEditorVoxelHand.VoxelHandShape.Material = materialEnum;
                }
            }
            // another shape type
            else
            {
                //  float newShapeSize = size;
                // if ((newShapeSize < MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (newShapeSize > MyVoxelConstants.MAX_VOXEL_HAND_SIZE))

                float newShapeSize = MyVoxelConstants.DEFAULT_VOXEL_HAND_SIZE;

                MyMwcPositionAndOrientation positionAndOritentation = new MyMwcPositionAndOrientation(MySpectator.Position, Vector3.Forward, Vector3.Up);
                switch (voxelHandShapeType)
                {
                case MyVoxelHandShapeType.Sphere:
                    MyMwcObjectBuilder_VoxelHand_Sphere sphereObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Sphere(positionAndOritentation, newShapeSize, modeType);
                    MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandSphere();
                    ((MyVoxelHandSphere)MyEditorVoxelHand.VoxelHandShape).Init(sphereObjectBuilder, null);
                    break;

                case MyVoxelHandShapeType.Box:
                    MyMwcObjectBuilder_VoxelHand_Box boxObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Box(positionAndOritentation, newShapeSize, modeType);
                    MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandBox();
                    ((MyVoxelHandBox)MyEditorVoxelHand.VoxelHandShape).Init(boxObjectBuilder, null);
                    break;

                case MyVoxelHandShapeType.Cuboid:
                    MyMwcObjectBuilder_VoxelHand_Cuboid cuboidObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cuboid(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, newShapeSize, newShapeSize, modeType);
                    MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCuboid();
                    ((MyVoxelHandCuboid)MyEditorVoxelHand.VoxelHandShape).Init(cuboidObjectBuilder, null);
                    break;

                case MyVoxelHandShapeType.Cylinder:
                    MyMwcObjectBuilder_VoxelHand_Cylinder cylinderObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cylinder(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, modeType);
                    MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCylinder();
                    ((MyVoxelHandCylinder)MyEditorVoxelHand.VoxelHandShape).Init(cylinderObjectBuilder, null);
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }
                MyEditorVoxelHand.VoxelHandShape.Material = materialEnum;
            }

            if (IsProjected)
            {
                if (!MyFakes.MWBUILDER)
                {
                    if ((distance >= MyVoxelConstants.MIN_PROJECTED_VOXEL_HAND_OFFSET) && (distance <= MyVoxelConstants.MAX_PROJECTED_VOXEL_HAND_OFFSET))
                    {
                        MyEditorVoxelHand.SetShapeDistance(distance);
                    }
                }
            }
            else if (IsProjectedToWaypoints)
            {
            }
            else
            {
                if ((distance >= MyVoxelConstants.MIN_VOXEL_HAND_DISTANCE) && (distance <= MyVoxelConstants.MAX_VOXEL_HAND_DISTANCE))
                {
                    MyEditorVoxelHand.SetShapeDistance(distance);
                }
            }

            MyEditorVoxelHand.UpdateShapePosition();
        }
コード例 #6
0
ファイル: MyVoxelMap.cs プロジェクト: Bunni/Miner-Wars-2081
        public override void BeforeSave()
        {
            base.BeforeSave();
            // we convert explosions to voxel hands
            foreach (BoundingSphere explosion in m_explosions)
            {
                MyVoxelHandSphere voxelHandSphere = new MyVoxelHandSphere();
                MyMwcObjectBuilder_VoxelHand_Sphere builder = new MyMwcObjectBuilder_VoxelHand_Sphere(new MyMwcPositionAndOrientation(explosion.Center, Vector3.Forward, Vector3.Up), explosion.Radius, MyMwcVoxelHandModeTypeEnum.SUBTRACT);
                voxelHandSphere.Init(builder, this);
                m_voxelHandShapes.Add(voxelHandSphere);
            }

            m_explosions.Clear();
        }