Exemplo n.º 1
0
        private void updateModulePositions()
        {
            //update for model scale
            topModule.model.updateScaleForDiameter(topDiameter);
            coreModule.model.updateScaleForDiameter(coreDiameter);
            bottomModule.model.updateScaleForDiameter(bottomDiameter);
            solarModule.model.updateScale(1);

            //calc positions
            float yPos     = topModule.moduleHeight + (coreModule.moduleHeight * 0.5f);
            float topDockY = yPos;

            yPos -= topModule.moduleHeight;
            float topY = yPos;

            yPos -= coreModule.moduleHeight;
            float coreY   = yPos;
            float bottomY = coreY;

            yPos -= bottomModule.moduleHeight;
            float bottomDockY = yPos;

            //update internal ref of position
            topModule.setPosition(topY);
            coreModule.setPosition(coreY);
            solarModule.setPosition(coreY);
            bottomModule.setPosition(bottomY, ModelOrientation.BOTTOM);

            //update actual model positions and scales
            topModule.updateModel();
            coreModule.updateModel();
            bottomModule.updateModel();
            solarModule.updateModel();
        }
Exemplo n.º 2
0
 private void updateModelScale()
 {
     modelTransform.localScale = new Vector3(currentScale, currentScale, currentScale);
     standoffModule.model.updateScaleForDiameter(currentScale * structureScale);
     standoffModule.setPosition(structureOffset * currentScale - standoffModule.model.currentHeight, ModelOrientation.TOP);
     standoffModule.updateModel();
 }
Exemplo n.º 3
0
        private void updateModelScale()
        {
            if (modelTransform != null)
            {
                modelTransform.localScale = new Vector3(currentScale, currentScale, currentScale);
            }
            standoffModule.model.updateScaleForDiameter(currentScale * structureScale);
            float position = -standoffModule.moduleHeight - structureOffset * currentScale;

            standoffModule.setPosition(position, ModelOrientation.TOP);
            standoffModule.updateModel();
        }
Exemplo n.º 4
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);
            Transform  root = part.transform.FindRecursive("model").FindOrCreate(rootTransformName);

            models = new ModelModule <PositionedModelData, SSTUModelSwitch2>(part, this, root, ModelOrientation.TOP, nameof(modelPersistentData), nameof(currentModel), nameof(currentTexture));
            models.getSymmetryModule = m => m.models;
            models.setupModelList(ModelData.parseModels <PositionedModelData>(node.GetNodes("MODEL"), m => new PositionedModelData(m)));
            models.setupModel();
            models.model.updateScale(currentScale);
            models.updateModel();
            updateMassAndCost();
            updateAttachNodes(false);
        }
Exemplo n.º 5
0
        private void updateModulePositions()
        {
            //update for model scale
            topModule.model.updateScaleForDiameter(currentDiameter * coreModule.model.topRatio);
            coreModule.model.updateScaleForDiameter(currentDiameter);
            bottomModule.model.updateScaleForDiameter(currentDiameter * coreModule.model.bottomRatio);
            solarModule.model.updateScale(1);
            float coreScale = coreModule.model.currentDiameterScale;

            rcsModule.model.updateScale(coreScale);

            //calc positions
            float yPos = topModule.moduleHeight + (coreModule.moduleHeight * 0.5f);

            yPos -= topModule.moduleHeight;
            float topY = yPos;

            yPos -= coreModule.moduleHeight;
            float coreY   = yPos;
            float bottomY = coreY;

            yPos -= bottomModule.moduleHeight;
            float bottomDockY = yPos;

            //update internal ref of position
            topModule.setPosition(topY);
            coreModule.setPosition(coreY);
            solarModule.setPosition(coreY);
            bottomModule.setPosition(bottomY, ModelOrientation.BOTTOM);
            rcsModule.setPosition(coreY + (coreScale * currentRCSOffset * coreModule.model.rcsOffsetRange) + (coreScale * coreModule.model.rcsPosition));

            //update actual model positions and scales
            topModule.updateModel();
            coreModule.updateModel();
            bottomModule.updateModel();
            solarModule.updateModel();
            rcsModule.model.currentHorizontalPosition = coreModule.model.currentDiameterScale * coreModule.model.modelDefinition.rcsHorizontalPosition;
            rcsModule.updateModel();
        }