public static bool Prefix(ref uGUI_DepthCompass __instance) { Ocean.DepthClass depthClass = Player.main.GetDepthClass(); if (__instance._cachedDepthClass != depthClass) { __instance._cachedDepthClass = depthClass; if (__instance._depthMode == uGUI_DepthCompass.DepthMode.Player) { __instance.UpdateHalfMoonSprite(); } } switch (depthClass) { case Ocean.DepthClass.Unsafe: case Ocean.DepthClass.Crush: __instance.shadow.sprite = __instance.shadowDanger; MaterialExtensions.SetBlending(__instance.shadow.material, Blending.AlphaBlend, false); __instance.depthText.color = __instance.textColorDanger; __instance.suffixText.color = __instance.textColorDanger; return(false); } __instance.shadow.sprite = __instance.shadowNormal; MaterialExtensions.SetBlending(__instance.shadow.material, Blending.Multiplicative, true); __instance.depthText.color = __instance.textColorNormal; __instance.suffixText.color = __instance.textColorNormal; return(false); }
public static void Postfix(ref Ocean.DepthClass __result) { float depth = Ocean.main.GetDepthOf(Player.main.gameObject); __result = Ocean.DepthClass.Safe; if (Player.main.IsSwimming() && depth >= divingCrushDepth) { __result = Ocean.DepthClass.Crush; } }
public static bool GetDepthClass(Player __instance, ref Ocean.DepthClass __result) { Ocean.DepthClass result = Ocean.DepthClass.Surface; CrushDamage crushDamage = null; var currSub = __instance.currentSub; var mode = (Mode)PlayerPatches.mode.GetValue(__instance); var living = (Living)__instance; if ((currSub != null && !currSub.isBase) || mode == Mode.LockedPiloting) { crushDamage = ((!(currSub != null)) ? living.gameObject.GetComponentInParent <CrushDamage>() : currSub.gameObject.GetComponent <CrushDamage>()); } if (crushDamage != null) { result = crushDamage.GetDepthClass(); __instance.crushDepth = crushDamage.crushDepth; } else { var c = GameModeUtilsPatches.currentConfig.Oxygen; __instance.crushDepth = 0f; float depthOf = Ocean.GetDepthOf(living.gameObject); if (depthOf > c.DeficiencyDepths[1]) { result = Ocean.DepthClass.Crush; } else if (depthOf > c.DeficiencyDepths[0]) { result = Ocean.DepthClass.Unsafe; } else if (depthOf > __instance.GetSurfaceDepth()) { result = Ocean.DepthClass.Safe; } } __result = result; return(false); }