public void Update()
        {
            if (Deployable)
            {
                foreach (AnimationState deployState in deployStates)
                {
                    deployState.normalizedTime = Mathf.Clamp01(deployState.normalizedTime);
                }
                if (State == ModuleDeployableSolarPanel.panelStates.RETRACTING)
                {
                    if (EvalAnimationCompletionReversed(deployStates) == 0f)
                    {
                        State = ModuleDeployableSolarPanel.panelStates.RETRACTED;
                    }
                }

                if (State == ModuleDeployableSolarPanel.panelStates.EXTENDING)
                {
                    if (EvalAnimationCompletion(deployStates) == 1f)
                    {
                        State = ModuleDeployableSolarPanel.panelStates.EXTENDED;
                    }
                }

                if ((State == ModuleDeployableSolarPanel.panelStates.EXTENDED && Events["DeployPanels"].active) || (State == ModuleDeployableSolarPanel.panelStates.RETRACTED && Events["RetractPanels"].active))
                {
                    Events["DeployPanels"].active  = !Events["DeployPanels"].active;
                    Events["RetractPanels"].active = !Events["RetractPanels"].active;
                }
            }
        }
        // Deploy Panels
        public void Deploy()
        {
            if (!Deployable)
                return;

            foreach (AnimationState deployState in deployStates)
            {
                deployState.speed = 1;
            }
            State = ModuleDeployableSolarPanel.panelStates.EXTENDING;
        }
Exemplo n.º 3
0
 public void Startup()
 {
     this.panelState = base.module.panelState;
     if (this.panelState == ModuleDeployableSolarPanel.panelStates.EXTENDED)
     {
         core.EnableFailure("TestFlightFailure_SolarMechFail");
     }
     else
     {
         core.DisableFailure("TestFlightFailure_SolarMechFail");
     }
 }
 public void Startup()
 {
     this.panelState = base.module.panelState;
     if (this.panelState == ModuleDeployableSolarPanel.panelStates.EXTENDED)
     {
         core.EnableFailure("TestFlightFailure_SolarMechFail");
     }
     else
     {
         core.DisableFailure("TestFlightFailure_SolarMechFail");
     }
 }
Exemplo n.º 5
0
 public override void OnUpdate()
 {
     if (this.panelState != base.module.panelState)
     {
         this.panelState = base.module.panelState;
         if (TestFlightEnabled && !base.part.ShieldedFromAirstream && (this.panelState == ModuleDeployableSolarPanel.panelStates.EXTENDED) != this.failureActive)
         {
             this.failureActive = !this.failureActive;
             if (this.failureActive)
             {
                 core.EnableFailure("TestFlightFailure_SolarMechFail");
             }
             else
             {
                 core.DisableFailure("TestFlightFailure_SolarMechFail");
             }
         }
     }
 }
 public override void OnUpdate()
 {
     if (this.panelState != base.module.panelState)
     {
         this.panelState = base.module.panelState;
         if (TestFlightEnabled && !base.part.ShieldedFromAirstream && (this.panelState == ModuleDeployableSolarPanel.panelStates.EXTENDED) != this.failureActive)
         {
             this.failureActive = !this.failureActive;
             if (this.failureActive)
             {
                 core.EnableFailure("TestFlightFailure_SolarMechFail");
             }
             else
             {
                 core.DisableFailure("TestFlightFailure_SolarMechFail");
             }
         }
     }
 }
Exemplo n.º 7
0
        public static SolarPanelState ToSolarPanelState(this ModuleDeployableSolarPanel.panelStates state)
        {
            switch (state)
            {
            case ModuleDeployableSolarPanel.panelStates.EXTENDED:
                return(SolarPanelState.Extended);

            case ModuleDeployableSolarPanel.panelStates.RETRACTED:
                return(SolarPanelState.Retracted);

            case ModuleDeployableSolarPanel.panelStates.EXTENDING:
                return(SolarPanelState.Extending);

            case ModuleDeployableSolarPanel.panelStates.RETRACTING:
                return(SolarPanelState.Retracting);

            case ModuleDeployableSolarPanel.panelStates.BROKEN:
                return(SolarPanelState.Broken);

            default:
                throw new ArgumentOutOfRangeException("state");
            }
        }
        // Retract Panels
        public void Retract()
        {
            if (!Deployable)
                return;

            foreach (AnimationState deployState in deployStates)
            {
                deployState.speed = -1;
            }
            State = ModuleDeployableSolarPanel.panelStates.RETRACTING;
        }
        public override void OnUpdate()
        {
            if (Deployable)
            {
                foreach (AnimationState deployState in deployStates)
                {
                    deployState.normalizedTime = Mathf.Clamp01(deployState.normalizedTime);
                }
                if (State == ModuleDeployableSolarPanel.panelStates.RETRACTING)
                {
                    if (EvalAnimationCompletionReversed(deployStates) == 0f)
                        State = ModuleDeployableSolarPanel.panelStates.RETRACTED;
                }

                if (State == ModuleDeployableSolarPanel.panelStates.EXTENDING)
                {
                    if (EvalAnimationCompletion(deployStates) == 1f)
                        State = ModuleDeployableSolarPanel.panelStates.EXTENDED;
                }

                if ((State == ModuleDeployableSolarPanel.panelStates.EXTENDED && Events["DeployPanels"].active) || (State == ModuleDeployableSolarPanel.panelStates.RETRACTED && Events["RetractPanels"].active))
                {
                    Events["DeployPanels"].active = !Events["DeployPanels"].active;
                    Events["RetractPanels"].active = !Events["RetractPanels"].active;
                }
            }
        }