28 lines
617 B
C#
28 lines
617 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class UIManager : MonoBehaviour
|
|
{
|
|
public PlayerStatBar playerStatBar;
|
|
[Header("ʼþ¼àÌý")]
|
|
public CharacterEventSO healthEvent;
|
|
|
|
private void OnEnable()
|
|
{
|
|
healthEvent.OnEventRaised += OnHealthEvent;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
healthEvent.OnEventRaised -= OnHealthEvent;
|
|
}
|
|
|
|
private void OnHealthEvent(Character character)
|
|
{
|
|
var persentage = character.currentHealth / character.maxHealth;
|
|
playerStatBar.OnHealthChange(persentage);
|
|
}
|
|
}
|