Example #1
0
        protected override MyMwcObjectBuilder_Base GetObjectBuilderInternal(bool getExactCopy)
        {
            MyMwcObjectBuilder_VoxelHand_Cuboid objectBuilder = (MyMwcObjectBuilder_VoxelHand_Cuboid)base.GetObjectBuilderInternal(getExactCopy);

            objectBuilder.Width1 = this.Width1;
            objectBuilder.Depth1 = this.Depth1;
            objectBuilder.Width2 = this.Width2;
            objectBuilder.Depth2 = this.Depth2;
            objectBuilder.Length = this.Length;
            return(objectBuilder);
        }
Example #2
0
        public void Init(MyMwcObjectBuilder_VoxelHand_Cuboid objectBuilder, MyVoxelMap parentVoxelMap)
        {
            base.Init(objectBuilder, parentVoxelMap);

            Width1 = objectBuilder.Width1;
            Depth1 = objectBuilder.Depth1;
            Width2 = objectBuilder.Width2;
            Depth2 = objectBuilder.Depth2;
            Length = objectBuilder.Length;

            UpdateLocalVolume();
        }
        public void Init(MyMwcObjectBuilder_VoxelHand_Cuboid objectBuilder, MyVoxelMap parentVoxelMap)
        {
            base.Init(objectBuilder, parentVoxelMap);

            Width1 = objectBuilder.Width1;
            Depth1 = objectBuilder.Depth1;
            Width2 = objectBuilder.Width2;
            Depth2 = objectBuilder.Depth2;
            Length = objectBuilder.Length;

            UpdateLocalVolume();
        }
        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();
        }