From 14ecb82d8f57faa7ec70fe0c1c7e035eda2433d0 Mon Sep 17 00:00:00 2001 From: ambrosia13 Date: Mon, 21 Apr 2025 13:53:17 -0500 Subject: [PATCH] Implement git restore upgrade --- Assets/Scripts/Door.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Door.cs b/Assets/Scripts/Door.cs index 7d06b20..8317e55 100644 --- a/Assets/Scripts/Door.cs +++ b/Assets/Scripts/Door.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -10,14 +11,24 @@ public class Door : MonoBehaviour void OnTriggerEnter(Collider other) { - GameState.Instance.roomCount++; - // Load the Basic L Room scene when this is entered // FIXME: make this adjustable room type // Bugfix: made it so only the player can trigger the door. if (other.tag == "Player") { SceneManager.LoadScene(room_name); + + GameState.Instance.roomCount++; + + // Git restore upgrade - restore x% of health when leaving a room + float playerMaxHealth = Level_manager.instance.PlayerMaxHealth; + float restorePercent = 0.01f * Level_manager.instance.gitRestoreUpgradeModifier; + float restoreAmount = playerMaxHealth * restorePercent; + + float newHealth = Level_manager.instance.PlayerHealth + restoreAmount; + Level_manager.instance.SetHealth(Math.Min(playerMaxHealth, newHealth)); + + Debug.Log("Player entered a door"); } } }