public override void OnLoad(ConfigNode node) { base.OnLoad(node); try { panelState = (SSTUPanelState)Enum.Parse(typeof(SSTUPanelState), savedAnimationState); } catch { panelState = SSTUPanelState.RETRACTED; } initializeState(); }
private void setPanelState(SSTUPanelState newState) { SSTUPanelState oldState = panelState; panelState = newState; switch (newState) { case SSTUPanelState.BROKEN: { setAnimationState(AnimState.STOPPED_END); breakPanels(); break; } case SSTUPanelState.EXTENDED: { setAnimationState(AnimState.STOPPED_END); break; } case SSTUPanelState.EXTENDING: { setAnimationState(AnimState.PLAYING_FORWARD); break; } case SSTUPanelState.RETRACTED: { setAnimationState(AnimState.STOPPED_START); break; } case SSTUPanelState.RETRACTING: { retractLerp = 2f; //two second retract lerp time; decremented during lerp update break; } } energyFlow = 0.0f; savedAnimationState = panelState.ToString(); updateGuiData(); }
//set the panel state enum, updates persistent saved state variable and gui data and buttons private void setPanelState(SSTUPanelState newState) { SSTUPanelState oldState = panelState; panelState = newState; switch(newState) { case SSTUPanelState.BROKEN: { setAnimationState(SSTUAnimState.STOPPED_END); breakPanels(); break; } case SSTUPanelState.EXTENDED: { setAnimationState(SSTUAnimState.STOPPED_END); break; } case SSTUPanelState.EXTENDING: { setAnimationState(SSTUAnimState.PLAYING_FORWARD); setPanelsToDefaultOrientation(); break; } case SSTUPanelState.RETRACTED: { setAnimationState(SSTUAnimState.STOPPED_START); break; } case SSTUPanelState.RETRACTING: { setAnimationState(SSTUAnimState.PLAYING_BACKWARD); setPanelsToDefaultOrientation(); break; } } energyFlow = 0.0f; savedAnimationState = panelState.ToString(); updateGuiData(); }
//load saved persistent data... this should really only be the panel status (broken/extend/retract) public override void OnLoad(ConfigNode node) { base.OnLoad (node); try { panelState = (SSTUPanelState)Enum.Parse(typeof(SSTUPanelState), savedAnimationState); } catch { panelState = SSTUPanelState.RETRACTED; } initializeState(); }
private void setPanelState(SSTUPanelState newState) { SSTUPanelState oldState = panelState; panelState = newState; switch (newState) { case SSTUPanelState.BROKEN: { setAnimationState(AnimState.STOPPED_END); breakPanels(); break; } case SSTUPanelState.EXTENDED: { setAnimationState(AnimState.STOPPED_END); break; } case SSTUPanelState.EXTENDING: { setAnimationState(AnimState.PLAYING_FORWARD); break; } case SSTUPanelState.RETRACTED: { setAnimationState(AnimState.STOPPED_START); break; } case SSTUPanelState.RETRACTING: { retractLerp = 2f;//two second retract lerp time; decremented during lerp update break; } } energyFlow = 0.0f; savedAnimationState = panelState.ToString(); updateGuiData(); }