internal void UpdateLamps() { bool lampOn = Util.IsDark(eva.transform); if (showHelmet) { eva.TurnLamp(lampOn); } if (!showHelmet && eva.lampOn) { eva.TurnLamp(false); } }
/// <summary> /// Enable you to remove the helmet. /// </summary> /// <param name="eva"></param> /// <param name="showHelmet"></param> public static void ShowHelmet(this KerbalEVA eva, bool showHelmet) { foreach (Renderer renderer in eva.GetComponentsInChildren <Renderer>()) { var smr = renderer as SkinnedMeshRenderer; if (smr != null) { switch (smr.name) { case "helmet": { if (helmetMesh == null) { helmetMesh = smr.sharedMesh; } smr.sharedMesh = showHelmet ? helmetMesh : null; } break; case "visor": { if (visorMesh == null) { visorMesh = smr.sharedMesh; } smr.sharedMesh = showHelmet ? visorMesh : null; } break; } } } if (!showHelmet) { eva.TurnLamp(false); } }
/// <summary> /// Toggle the light of the current kerbal. /// </summary> /// <param name="eva"></param> public static void ToggleLight(this KerbalEVA eva) { eva.lampOn = !eva.lampOn; eva.TurnLamp(eva.lampOn); }