Exemple #1
0
 private void Start()
 {
     playerHealth = playerHealthObject.GetComponent <IHealth>();
     playerHealth.AddHealthBar(this);
     if (playerHealth == null)
     {
         Debug.LogWarning("Healthbar not connected to health");
     }
     HealthBarImage = GetComponent <Image>();
 }
Exemple #2
0
 private void Start()
 {
     mainCamera = Camera.main;
     myHealth   = GetComponent <NPCHealth>();
     myHealth.AddHealthBar(this);
     slider = GetComponentInChildren <Slider>();
     if (slider == null)
     {
         Debug.Log($"Slider not found for Healthbar on {gameObject}");
     }
     slider.gameObject.SetActive(false);
 }