using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.SocialPlatforms.Impl; using UnityEngine.UI; public class GameModeControllerUI : MonoBehaviour { public TextMeshProUGUI HealthText, KillsText; public Image healthBar; private Color mainColor = new Color(0.06666667f, 0.2509804f, 0.5176471f, 1f); public GameManager gameManager; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { HealthText.text = gameManager.GetHealth().ToString(); KillsText.text = gameManager.GetNoKills().ToString(); healthBar.fillAmount = gameManager.GetHealth() / 100f; if (healthBar.fillAmount < 0.3f) { healthBar.color = Color.red; } else { healthBar.color = mainColor; } } }