Пример #1
0
 /// <summary>
 /// Update the engine scale and position for scale.
 /// </summary>
 private void updateEnginePositionAndScale()
 {
     engineModels.setScale(currentEngineScale);
     engineModels.root.localRotation = this.invertEngines ? Quaternion.Euler(180, 0, 0) : Quaternion.identity;
     engineModels.setPosition(-currentHeight * 0.5f + engineModels.moduleHeight * 0.5f);
     engineModels.updateModelMeshes();
     engineModels.renameEngineThrustTransforms(engineThrustTransformName);
 }
Пример #2
0
 private void updateModelScale()
 {
     rcsBlockModule.setPosition(0);
     rcsBlockModule.setScale(currentScale);
     rcsBlockModule.updateModelMeshes();
     standoffModule.setDiameterFromAbove(rcsBlockModule.moduleDiameter, 0f);
     standoffModule.setPosition(rcsBlockModule.moduleBottom - standoffModule.moduleHeight);
     standoffModule.updateModelMeshes();
 }
Пример #3
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;
            double hsp  = 1;
            double dens = 1;

            PartResourceDefinition resource = PartResourceLibrary.Instance.GetDefinition(resourceName);

            hsp  = resource.specificHeatCapacity;
            dens = resource.density;

            fluxPerResourceUnit = hsp * ablationEfficiency * dens;
            baseSkinIntMult     = part.skinInternalConductionMult;
            baseCondMult        = part.heatConductivity;

            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            Transform mhsRoot = part.transform.FindRecursive("model").FindOrCreate("SSTU-MHS-Root");

            ConfigNode[] modelNodes = node.GetNodes("MODELS");
            ModelDefinitionLayoutOptions[] models = SSTUModelData.getModelDefinitions(modelNodes);
            model = new ModelModule <SSTUModularHeatShield>(part, this, mhsRoot, ModelOrientation.CENTRAL, nameof(currentShieldModel), null, nameof(currentShieldTexture), nameof(modelPersistentData), null, null, null, null);
            model.getSymmetryModule = (m) => m.model;
            model.setupModelList(models);
            model.setupModel();
            model.setScaleForDiameter(currentDiameter);
            model.setPosition(0);
            model.updateModelMeshes();
            model.updateSelections();
            model.volumeScalar = resourceScalePower;
            model.massScalar   = resourceScalePower;
            if (standAlonePart)
            {
                updateDragCube();
                updateAttachNodes(false);
            }
            SSTUModInterop.updateResourceVolume(part);
            ConfigNode[] typeNodes = node.GetNodes("SHIELDTYPE");
            shieldTypeData        = HeatShieldTypeData.load(typeNodes);
            currentShieldTypeData = Array.Find(shieldTypeData, m => m.baseType.name == currentShieldType);
            updateModuleStats();
            updatePartCost();
            SSTUModInterop.onPartGeometryUpdate(part, false);
            SSTUModInterop.updateResourceVolume(part);
            SSTUStockInterop.fireEditorUpdate();//update for mass/cost/etc.
        }
Пример #4
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            ModelDefinitionLayoutOptions[] defs = SSTUModelData.getModelDefinitions(node.GetNodes("MODEL"));
            Transform root = part.transform.FindRecursive("model").FindOrCreate(rootTransformName);

            models      = new ModelModule <SSTUModelSwitch>(part, this, root, ModelOrientation.TOP, nameof(currentModel), null, nameof(currentTexture), nameof(modelPersistentData), nameof(animationPersistentData), nameof(animationMaxDeploy), nameof(enableAnimationEvent), nameof(disableAnimationEvent));
            models.name = "ModelSwitch";
            models.getSymmetryModule = m => m.models;
            models.getValidOptions   = () => defs;
            models.setupModelList(defs);
            models.setupModel();
            models.setScale(currentScale);
            models.updateModelMeshes();
            models.updateSelections();
            updateMassAndCost();
            updateAttachNodes(false);
        }