joerkig

Untitled

Apr 13th, 2021
629
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public override void OnLateUpdate()
  2.         {
  3.             GameObject playerInteractor = GameObject.Find("Player/PlayerInteractor");
  4.             if (playerInteractor != null)
  5.             {
  6.                 PlayerHealth playerHealth = playerInteractor.GetComponent<PlayerHealth>();
  7.                 if (playerHealth != null)
  8.                 {
  9.                     string healthPip = "<img src=\"HealthPip.png\">";
  10.                     string healthPipCracked = "<img src=\"HealthPipCracked.png\">";
  11.                     int currentHealth = (int)Math.Ceiling(playerHealth.CurrentHealth);
  12.                     int maxHealth = (int)Math.Ceiling(playerHealth.MaxHealth);
  13.                     int emptyHealth = maxHealth - currentHealth;
  14.                     if (playerHealth.MaxHealth.ToString() != File.ReadAllText(MelonUtils.UserDataDirectory + "\\MaxHealth.txt"))
  15.                     {
  16.                         File.WriteAllText(MelonUtils.UserDataDirectory + "\\MaxHealth.txt", playerHealth.MaxHealth.ToString());
  17.                         File.WriteAllText(MelonUtils.UserDataDirectory + "\\Health.html", "<center>" + String.Concat(Enumerable.Repeat(healthPip, currentHealth)) + String.Concat(Enumerable.Repeat(healthPipCracked, emptyHealth)) + "</center><script>function timedRefresh(timeoutPeriod) {setTimeout(\"location.reload(true); \",timeoutPeriod);} window.onload = timedRefresh(2000);</script>");
  18.                     }
  19.                     if (playerHealth.CurrentHealth.ToString() != File.ReadAllText(MelonUtils.UserDataDirectory + "\\CurrentHealth.txt"))
  20.                     {
  21.                         File.WriteAllText(MelonUtils.UserDataDirectory + "\\CurrentHealth.txt", playerHealth.CurrentHealth.ToString());
  22.                         File.WriteAllText(MelonUtils.UserDataDirectory + "\\Health.html", "<center>" + String.Concat(Enumerable.Repeat(healthPip, currentHealth)) + String.Concat(Enumerable.Repeat(healthPipCracked, emptyHealth)) + "</center><script>function timedRefresh(timeoutPeriod) {setTimeout(\"location.reload(true); \",timeoutPeriod);} window.onload = timedRefresh(2000);</script>");
  23.                     }
  24.                     //File.WriteAllText(MelonUtils.UserDataDirectory + "\\Health.html", "<center>" + String.Concat(Enumerable.Repeat(healthPip, currentHealth)) + String.Concat(Enumerable.Repeat(healthPipCracked, emptyHealth)) + "</center><script>function timedRefresh(timeoutPeriod) {setTimeout(\"location.reload(true); \",timeoutPeriod);} window.onload = timedRefresh(2000);</script>");
  25.                 }
  26.             }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×