public void Init(string hudLabelText, MyMwcObjectBuilder_MysteriousCube objectBuilder, Matrix matrix) 
        {
            Flags |= EntityFlags.EditableInEditor;

            StringBuilder hudLabelTextSb = (hudLabelText == null) ? null : new StringBuilder(hudLabelText);

            

            switch (objectBuilder.MysteriousCubeType)
            {
                case MyMwcObjectBuilder_MysteriousCube_TypesEnum.Type1:
                    base.Init(hudLabelTextSb, MyModelsEnum.MysteriousBox_matt_5m, null, null, null, objectBuilder);
                    m_diffuseColor = new Vector3(0, 0, 0);
                    break;

                case MyMwcObjectBuilder_MysteriousCube_TypesEnum.Type2:
                    base.Init(hudLabelTextSb, MyModelsEnum.MysteriousBox_spec_5m, null, null, null, objectBuilder);
                    m_diffuseColor = new Vector3(0, 0, 0);
                    break;

                case MyMwcObjectBuilder_MysteriousCube_TypesEnum.Type3:
                    base.Init(hudLabelTextSb, MyModelsEnum.MysteriousBox_mid_5m, null, null, null, objectBuilder);
                    m_diffuseColor = new Vector3(0, 0, 0);
                    break;

            }

            base.InitBoxPhysics(MyMaterialType.METAL, ModelLod0, 1f, 0f, MyConstants.COLLISION_LAYER_DEFAULT, RigidBodyFlag.RBF_RBO_STATIC);
            SetWorldMatrix(matrix);
            Save = true;
            this.Physics.Enabled = true;

           // NeedsUpdate = true;

        }
Example #2
0
 public void Add()
 {
     Vector3 position;
     if (GetAddPosition(out position))
     {
         Matrix matrix = Matrix.CreateTranslation(position);
         var cube = new MyMwcObjectBuilder_MysteriousCube(new CommonLIB.AppCode.Networking.MyMwcPositionAndOrientation(matrix));
         cube.MysteriousCubeType = MyMwcObjectBuilder_MysteriousCube_TypesEnum.Type2;
         MyEntities.CreateFromObjectBuilderAndAdd(null, cube, matrix);
     }
 }
        private void CreateMysteriousCube(Vector3 posMyst, List<MyMwcObjectBuilder_Base> addToList, Random rnd)
        {
            MyMwcObjectBuilder_MysteriousCube mysteriousCube = new MyMwcObjectBuilder_MysteriousCube(
            new MyMwcPositionAndOrientation(posMyst, Vector3.Forward, Vector3.Up)
            );

            MyMwcObjectBuilder_MysteriousCube_TypesEnum cubeType = (MyMwcObjectBuilder_MysteriousCube_TypesEnum)rnd.Item(Enum.GetValues(typeof(MyMwcObjectBuilder_MysteriousCube_TypesEnum)));
            mysteriousCube.MysteriousCubeType = cubeType;
            addToList.Add(mysteriousCube);
        }