enableModule() public method

public enableModule ( ) : void
return void
コード例 #1
0
        private void updateSolarModules()
        {
            if (!updateSolar)
            {
                return;
            }

            updateAnimationControl(solarAnimationID, solarModule.model, solarAnimationLayer);
            bool solarEnabled = solarModule.model.panelsEnabled;

            SSTUSolarPanelDeployable solar = part.GetComponent <SSTUSolarPanelDeployable>();

            if (solar != null)
            {
                if (solarEnabled)
                {
                    solar.resourceAmount  = solarModule.model.energy;
                    solar.pivotTransforms = solarModule.model.pivotNames;
                    solar.rayTransforms   = solarModule.model.sunNames;

                    SSTUSolarPanelDeployable.Axis axis = (SSTUSolarPanelDeployable.Axis)Enum.Parse(typeof(SSTUSolarPanelDeployable.Axis), solarModule.model.sunAxis);
                    solar.setSuncatcherAxis(axis);
                    solar.enableModule();
                }
                else
                {
                    solar.disableModule();
                }
            }
        }
コード例 #2
0
        private void updateSolarModules()
        {
            if (!updateSolar)
            {
                return;
            }
            if (animationControl == null)
            {
                SSTUAnimateControlled[] controls = part.GetComponents <SSTUAnimateControlled>();
                int len = controls.Length;
                for (int i = 0; i < len; i++)
                {
                    if (controls[i].animationID == solarAnimationID)
                    {
                        animationControl = controls[i]; break;
                    }
                }
            }

            animationControl.animationName = solarModule.animationName;
            animationControl.reInitialize();

            SSTUSolarPanelDeployable solar = part.GetComponent <SSTUSolarPanelDeployable>();

            if (solar == null)
            {
                return;
            }

            solar.resourceAmount           = solarModule.energy;
            solar.pivotTransforms          = solarModule.pivotNames;
            solar.secondaryPivotTransforms = solarModule.secPivotNames;
            solar.rayTransforms            = solarModule.sunNames;

            SSTUSolarPanelDeployable.Axis axis = (SSTUSolarPanelDeployable.Axis)Enum.Parse(typeof(SSTUSolarPanelDeployable.Axis), solarModule.sunAxis);
            solar.setSuncatcherAxis(axis);

            if (solarModule.panelsEnabled)
            {
                solar.enableModule();
            }
            else
            {
                solar.disableModule();
            }
        }
コード例 #3
0
        private void updateSolarModules()
        {
            if (!updateSolar)
            {
                return;
            }
            if (animationControl == null && !string.Equals("none", solarAnimationID))
            {
                SSTUAnimateControlled[] controls = part.GetComponents <SSTUAnimateControlled>();
                int len = controls.Length;
                for (int i = 0; i < len; i++)
                {
                    if (controls[i].animationID == solarAnimationID)
                    {
                        animationControl = controls[i];
                        break;
                    }
                }
                if (animationControl == null)
                {
                    MonoBehaviour.print("ERROR: Animation controller was null for ID: " + solarAnimationID);
                    return;
                }
            }

            bool   animEnabled  = solarModule.model.hasAnimation();
            bool   solarEnabled = solarModule.model.panelsEnabled;
            string animName     = string.Empty;
            float  animSpeed    = 1f;

            if (animEnabled)
            {
                ModelAnimationData mad = solarModule.model.modelDefinition.animationData[0];
                animName  = mad.animationName;
                animSpeed = mad.speed;
            }
            else
            {
                animName  = string.Empty;
                animSpeed = 1f;
            }

            if (animationControl != null)
            {
                animationControl.animationName  = animName;
                animationControl.animationSpeed = animSpeed;
                animationControl.reInitialize();
            }

            SSTUSolarPanelDeployable solar = part.GetComponent <SSTUSolarPanelDeployable>();

            if (solar != null)
            {
                if (solarEnabled)
                {
                    solar.resourceAmount  = solarModule.model.energy;
                    solar.pivotTransforms = solarModule.model.pivotNames;
                    solar.rayTransforms   = solarModule.model.sunNames;

                    SSTUSolarPanelDeployable.Axis axis = (SSTUSolarPanelDeployable.Axis)Enum.Parse(typeof(SSTUSolarPanelDeployable.Axis), solarModule.model.sunAxis);
                    solar.setSuncatcherAxis(axis);
                    solar.enableModule();
                }
                else
                {
                    solar.disableModule();
                }
            }
        }