Пример #1
0
        public SolarData(ConfigNode node)
        {
            name      = node.GetStringValue("name");
            modelName = node.GetStringValue("modelName", name);
            def       = SSTUModelData.getModelDefinition(modelName);
            ConfigNode solarNode = def.configNode.GetNode("SOLARDATA");

            //loaded from SOLARDATA from model def
            animationName = solarNode.GetStringValue("animationName");
            pivotNames    = solarNode.GetStringValue("pivotNames");
            secPivotNames = solarNode.GetStringValue("secPivotNames");
            sunNames      = solarNode.GetStringValue("sunNames");
            panelsEnabled = solarNode.GetBoolValue("enabled");
            sunAxis       = solarNode.GetStringValue("sunAxis", SSTUSolarPanelDeployable.Axis.ZPlus.ToString());
            //loaded from SOLARDATA with option of per-model override (energy, tech-unlock-upgrade-name)
            upgradeName = node.GetStringValue("upgrade", solarNode.GetStringValue("upgrade"));
            energy      = node.GetFloatValue("energy", solarNode.GetFloatValue("energy"));//allow local override of energy

            ConfigNode[] posNodes = node.GetNodes("POSITION");
            int          len      = posNodes.Length;

            positions = new SolarPosition[len];
            for (int i = 0; i < len; i++)
            {
                positions[i] = new SolarPosition(posNodes[i]);
            }
        }
Пример #2
0
        public SolarData(ConfigNode node) : base(node)
        {
            ConfigNode solarNode = modelDefinition.configNode.GetNode("SOLARDATA");

            if (solarNode == null)
            {
                panelsEnabled = false;
            }
            if (panelsEnabled)
            {
                pivotNames    = solarNode.GetStringValue("pivotNames");
                secPivotNames = solarNode.GetStringValue("secPivotNames");
                sunNames      = solarNode.GetStringValue("sunNames");
                panelsEnabled = solarNode.GetBoolValue("enabled");
                sunAxis       = solarNode.GetStringValue("sunAxis", SSTUSolarPanelDeployable.Axis.ZPlus.ToString());
                energy        = node.GetFloatValue("energy", solarNode.GetFloatValue("energy"));//allow local override of energy
                ConfigNode[] posNodes = node.GetNodes("POSITION");
                int          len      = posNodes.Length;
                positions = new SolarPosition[len];
                for (int i = 0; i < len; i++)
                {
                    positions[i] = new SolarPosition(posNodes[i]);
                }
            }
        }
Пример #3
0
        public SolarPosition[] getScaledPositions(float scale)
        {
            int len = this.positions.Length;

            SolarPosition[] positions = new SolarPosition[len];
            for (int i = 0; i < len; i++)
            {
                positions[i] = new SolarPosition(this.positions[i], scale);
            }
            return(positions);
        }
Пример #4
0
        public ServiceModuleSolarPanelConfiguration(ConfigNode node)
        {
            name     = node.GetStringValue("name");
            minScale = node.GetFloatValue("minScale", 0f);
            ConfigNode[] posNodes = node.GetNodes("POSITION");
            ConfigNode   posNode;
            int          len = posNodes.Length;

            positions = new SolarPosition[len];
            for (int i = 0; i < len; i++)
            {
                posNode      = posNodes[i];
                positions[i] = new SolarPosition(posNode);
            }
        }
 public SolarData(ConfigNode node)
 {
     name = node.GetStringValue("name");
     modelName = node.GetStringValue("modelName", name);
     upgradeName = node.GetStringValue("upgrade");
     def = SSTUModelData.getModelDefinition(modelName);
     ConfigNode solarNode = def.configNode.GetNode("SOLARDATA");
     animationName = solarNode.GetStringValue("animationName");
     pivotNames = solarNode.GetStringValue("pivotNames");
     secPivotNames = solarNode.GetStringValue("secPivotNames");
     sunNames = solarNode.GetStringValue("sunNames");
     energy = solarNode.GetFloatValue("energy");
     panelsEnabled = solarNode.GetBoolValue("enabled");
     sunAxis = solarNode.GetStringValue("sunAxis", SSTUSolarPanelDeployable.Axis.ZPlus.ToString());
     energy = node.GetFloatValue("energy", energy);//allow local override of energy
     ConfigNode[] posNodes = node.GetNodes("POSITION");
     int len = posNodes.Length;
     positions = new SolarPosition[len];
     for (int i = 0; i < len; i++)
     {
         positions[i] = new SolarPosition(posNodes[i]);
     }
 }
Пример #6
0
 public SolarPosition(SolarPosition pos, float scale)
 {
     this.position = pos.position * scale;
     this.rotation = pos.rotation;
     this.scale    = pos.scale;
 }