private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;
            if (currentDiameter > maxDiameter)
            {
                currentDiameter = maxDiameter;
            }
            if (currentDiameter < minDiameter)
            {
                currentDiameter = minDiameter;
            }

            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            AnimationData animData = new AnimationData(node.GetNode("ANIMATIONDATA"));

            animationModule = new AnimationModule(part, this, nameof(persistentState), null, nameof(enableAnimationEvent), nameof(disableAnimationEvent));
            animationModule.getSymmetryModule = m => ((SSTUWeldingDockingPort)m).animationModule;
            animationModule.setupAnimations(animData, part.transform.FindRecursive("model"), animationLayer);
            animationModule.onAnimStateChangeCallback = onAnimStateChange;

            updateModelScale();
            updateDragCubes();
            updatePartCost();
            updatePartMass();
        }
示例#2
0
        private void init()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;
            if (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight)
            {
                updateCrewCapacity(inflated ? inflatedCrew : deflatedCrew);
            }

            ConfigNode    node     = SSTUConfigNodeUtils.parseConfigNode(configNodeData);
            AnimationData animData = new AnimationData(node.GetNode("ANIMATIONDATA"));

            animationModule = new AnimationModule(part, this, nameof(persistentState), null, nameof(inflateEvent), nameof(deflateEvent));
            animationModule.getSymmetryModule = m => ((SSTUInflatable)m).animationModule;
            animationModule.setupAnimations(animData, part.transform.FindRecursive("model"), 0);
            animationModule.onAnimStateChangeCallback = onAnimationStateChange;

            resourceDef = PartResourceLibrary.Instance.GetDefinition(resourceName);
            if (resourceDef == null)
            {
                MonoBehaviour.print("ERROR: Could not locate resource for name: " + resourceName + " for " + this.name);
            }
            updateRequiredMass();
        }
示例#3
0
        private void initialize()
        {
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            AnimationData animData = new AnimationData(node.GetNode("ANIMATIONDATA"));

            animationModule = new AnimationModule(part, this, nameof(persistentState), nameof(animationMaxDeploy), nameof(enableAnimationEvent), nameof(disableAnimationEvent));
            animationModule.getSymmetryModule = m => ((SSTUAnimateControlled)m).animationModule;
            animationModule.setupAnimations(animData, part.transform.FindRecursive("model"), animationLayer);
            animationModule.onAnimStateChangeCallback = onAnimStateChange;
        }
示例#4
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;
            ConfigNode    node     = SSTUConfigNodeUtils.parseConfigNode(configNodeData);
            AnimationData animData = new AnimationData(node.GetNode("ANIMATIONDATA"));

            animationModule = new AnimationModule(part, this, nameof(persistentState), null, nameof(deployEngineEvent), nameof(retractEngineEvent));
            animationModule.getSymmetryModule = m => ((SSTUDeployableEngine)m).animationModule;
            animationModule.setupAnimations(animData, part.transform.FindRecursive("model"), 0);
            animationModule.onAnimStateChangeCallback = onAnimationStateChange;
        }
示例#5
0
        private void initialize()
        {
            if (!moduleIsEnabled)
            {
                //TODO -- UI disabling
                return;
            }
            if (initialized)
            {
                return;
            }
            initialized = true;
            AnimationData  animData = null;
            ModelSolarData msd      = null;
            ConfigNode     node     = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            if (node.HasValue("modelDefinition"))
            {
                ModelDefinition def = SSTUModelData.getModelDefinition(node.GetStringValue("modelDefinition"));
                if (def == null)
                {
                    MonoBehaviour.print("Could not locate model definition: " + node.GetStringValue("modelDefinition") + " for solar data");
                }
                else
                {
                    animData = def.animationData;
                    msd      = def.solarModuleData;
                }
            }
            //allow local override of animation data
            if (node.HasNode("ANIMATIONDATA"))
            {
                animData = new AnimationData(node.GetNode("ANIMATIONDATA"));
            }
            if (node.HasNode("SOLARDATA"))
            {
                msd = new ModelSolarData(node.GetNode("SOLARDATA"));
            }

            animationModule = new AnimationModule(part, this, nameof(persistentState), null, nameof(extendEvent), nameof(retractEvent));
            animationModule.getSymmetryModule = m => ((SSTUSolarPanelDeployable)m).animationModule;
            animationModule.setupAnimations(animData, part.transform.FindRecursive("model"), animationLayer);

            solarModule = new SolarModule(part, this, animationModule, Fields[nameof(solarPersistentData)], Fields[nameof(guiStatus)]);
            solarModule.getSymmetryModule = m => ((SSTUSolarPanelDeployable)m).solarModule;
            solarModule.setupSolarPanelData(new ModelSolarData[] { msd }, new Transform[] { part.transform.FindRecursive("model") });
            nominalSolarOutput = solarModule.standardPotentialOutput;
        }
示例#6
0
        private void loadConfigData(ConfigNode node)
        {
            //should only run the first time the part-module is initialized,
            // which had better be on the prefab part (or bad things will happen)
            // only tracked so as to not add duplicate animations/clips
            if (!prefabSetup)
            {
                prefabSetup = true;
                Transform root = part.transform.FindRecursive("model");

                ConfigNode[]   emissiveNodes = node.GetNodes("EMISSIVE");
                int            len           = emissiveNodes.Length;
                EmissiveData[] emissiveDatas = new EmissiveData[len];
                for (int i = 0; i < len; i++)
                {
                    emissiveDatas[i] = new EmissiveData(emissiveNodes[i]);
                    emissiveDatas[i].createAnimationClips(root);
                }

                ConfigNode[] lightNodes = node.GetNodes("LIGHT");
                len = lightNodes.Length;
                LightData[] lightDatas = new LightData[lightNodes.Length];
                for (int i = 0; i < len; i++)
                {
                    lightDatas[i] = new LightData(lightNodes[i]);
                    lightDatas[i].createAnimationClips(root);
                }
            }

            //will not function without animation data being loaded/present
            // the EMISSIVE and LIGHT blocks -build- new animations that can be
            // referenced inside of the ANIMATION data blocks
            AnimationData animData = new AnimationData(node.GetNode("ANIMATIONDATA"));

            //setup animation control module.  limit/deploy/retract events passed as null, as UI visibility/updating handled externally to ensure syncing to light animation state
            animationController = new AnimationModule(part, this, nameof(animationPersistentData), null, nameof(enableLightsEvent), nameof(disableLightsEvent));
            animationController.getSymmetryModule = m => ((SSTUAnimateLight)m).animationController;
            animationController.setupAnimations(animData, part.transform.FindRecursive("model"), animationLayer);
        }