System.Collections.IEnumerator ErrorCallback(float seconds, MEPLabStatus targetState) { yield return(new WaitForSeconds(seconds)); ScreenMessages.PostScreenMessage("#ne_Warning_robotic_arm_failure", 6, ScreenMessageStyle.UPPER_CENTER); MEPlabState = targetState; }
public override void OnUpdate() { base.OnUpdate(); if (lastUpdate + refreshInterval < Time.time) { lastUpdate = Time.time; MEP_Module lab = part.GetComponent<MEP_Module>(); if (lab.MEPlabState != lastLabStatus) { GameDatabase.TextureInfo newTexture = getTextureForState(lab.MEPlabState); if (newTexture != null) { changeTexture(newTexture); } else { NE_Helper.logError("New Texture null"); } lastLabStatus = lab.MEPlabState; } } }
public override void OnLoad(ConfigNode node) { base.OnLoad(node); string stateString = node.GetValue(MEP_STATE_VALUE); if (stateString != null) { MEPlabState = MEPLabStatusFactory.getType(stateString); } exposureSlot = getLabEquipmentSlotByType(node, EXPOSURE_LAB_EQUIPMENT_TYPE); }
public override void OnLoad(ConfigNode node) { base.OnLoad(node); string stateString = node.GetValue(MEP_STATE_VALUE); if (stateString != null) { MEPlabState = MEPLabStatusFactory.getType(stateString); } exposureSlot = getLabEquipmentSlot(node.GetNode(SLOT_CONFIG_NODE_NAME)); }
public void DeployPlatform() { switch (MEPlabState) { case MEPLabStatus.NOT_READY: playAnimation(deployAnimName, 1f, 0); MEPlabState = MEPLabStatus.READY; Events["DeployPlatform"].guiName = Localizer.GetStringByTag("#ne_Retract_Platform"); break; case MEPLabStatus.READY: playAnimation(deployAnimName, -1f, 1); MEPlabState = MEPLabStatus.NOT_READY; Events["DeployPlatform"].guiName = Localizer.GetStringByTag("#ne_Deploy_Platform"); break; } }
public void DeployPlatform() { switch (MEPlabState) { case MEPLabStatus.NOT_READY: playAnimation(deployAnimName, 1f, 0); MEPlabState = MEPLabStatus.READY; Events["DeployPlatform"].guiName = "Retract Platform"; break; case MEPLabStatus.READY: playAnimation(deployAnimName, -1f, 1); MEPlabState = MEPLabStatus.NOT_READY; Events["DeployPlatform"].guiName = "Deploy Platform"; break; } }
public void FixArm() { Events["FixArm"].guiActiveUnfocused = false; armOps = 0; switch (MEPlabState) { case MEPLabStatus.ERROR_ON_START: MEPlabState = MEPLabStatus.RUNNING; playAnimation(errorOnStartAnimName, -1f, 1f); ScreenMessages.PostScreenMessage("#ne_Robotic_arm_fixed_Experiment_will_start_soon", 2, ScreenMessageStyle.UPPER_CENTER); StartCoroutine(playAninimationAfter(5.8f, startExpAnimName, 1f, 0)); break; case MEPLabStatus.ERROR_ON_STOP: ScreenMessages.PostScreenMessage("#ne_Robotic_arm_fixed", 2, ScreenMessageStyle.UPPER_CENTER); playAnimation(errorOnStopAnimName, 1f, 0f); StartCoroutine(waitForAnimation(5.8f)); break; } }
public void actionExp() { if (exposureSlot.isExposureAction()) { if (isSuccessfull()) { exposureSlot.experimentAction(); ++armOps; switch (MEPlabState) { case MEPLabStatus.READY: playAnimation(startExpAnimName, 1f, 0f); MEPlabState = MEPLabStatus.RUNNING; break; case MEPLabStatus.RUNNING: playAnimation(startExpAnimName, -1f, 1f); MEPlabState = MEPLabStatus.READY; break; } } else { switch (MEPlabState) { case MEPLabStatus.READY: errorOnStart(); break; case MEPLabStatus.RUNNING: errorOnStop(); break; } } } else { exposureSlot.experimentAction(); } }
public override void OnUpdate() { base.OnUpdate(); if (lastUpdate + refreshInterval < Time.time) { lastUpdate = Time.time; MEP_Module lab = part.GetComponent <MEP_Module>(); if (lab.MEPlabState != lastLabStatus) { GameDatabase.TextureInfo newTexture = getTextureForState(lab.MEPlabState); if (newTexture != null) { changeTexture(newTexture); } else { NE_Helper.logError("New Texture null"); } lastLabStatus = lab.MEPlabState; } } }
private GameDatabase.TextureInfo getTextureForState(MEPLabStatus p) { switch (p) { case MEPLabStatus.NOT_READY: if (notReady == null) { notReady = getTexture(folder, notReadyTexture); } return(notReady); case MEPLabStatus.READY: if (ready == null) { ready = getTexture(folder, readyTexture); } return(ready); case MEPLabStatus.RUNNING: if (running == null) { running = getTexture(folder, runningTexture); } return(running); case MEPLabStatus.ERROR_ON_START: case MEPLabStatus.ERROR_ON_STOP: if (error == null) { error = getTexture(folder, errorTexture); } return(error); default: return(null); } }
System.Collections.IEnumerator waitForAnimation(float seconds) { yield return new WaitForSeconds(seconds); MEPlabState = MEPLabStatus.RUNNING; }
System.Collections.IEnumerator ErrorCallback(float seconds, MEPLabStatus targetState) { yield return new WaitForSeconds(seconds); ScreenMessages.PostScreenMessage("Warning: robotic arm failure", 6, ScreenMessageStyle.UPPER_CENTER); MEPlabState = targetState; }
public void FixArm() { Events["FixArm"].guiActiveUnfocused = false; armOps = 0; switch (MEPlabState) { case MEPLabStatus.ERROR_ON_START: MEPlabState = MEPLabStatus.RUNNING; playAnimation(errorOnStartAnimName, -1f, 1f); ScreenMessages.PostScreenMessage("Robotic arm fixed. Experiment will start soon.", 2, ScreenMessageStyle.UPPER_CENTER); StartCoroutine(playAninimationAfter(5.8f,startExpAnimName, 1f, 0)); break; case MEPLabStatus.ERROR_ON_STOP: ScreenMessages.PostScreenMessage("Robotic arm fixed.", 2, ScreenMessageStyle.UPPER_CENTER); playAnimation(errorOnStopAnimName, 1f, 0f); StartCoroutine(waitForAnimation(5.8f)); break; } }
public void errorOnStart() { MEPlabState = MEPLabStatus.RUNNING; playAnimation(errorOnStartAnimName, 1f, 0f); StartCoroutine(ErrorCallback(5.8f, MEPLabStatus.ERROR_ON_START)); }
private GameDatabase.TextureInfo getTextureForState(MEPLabStatus p) { switch (p) { case MEPLabStatus.NOT_READY: if (notReady == null) notReady = getTexture(folder, notReadyTexture); return notReady; case MEPLabStatus.READY: if (ready == null) ready = getTexture(folder, readyTexture); return ready; case MEPLabStatus.RUNNING: if (running == null) running = getTexture(folder, runningTexture); return running; case MEPLabStatus.ERROR_ON_START: case MEPLabStatus.ERROR_ON_STOP: if (error == null) error = getTexture(folder, errorTexture); return error; default: return null; } }
System.Collections.IEnumerator waitForAnimation(float seconds) { yield return(new WaitForSeconds(seconds)); MEPlabState = MEPLabStatus.RUNNING; }