using System.Collections; using System.Collections.Generic; using UnityEngine; using Sirenix.OdinInspector; using KairoEngine.Core; namespace KairoEngine.CharacterSystem { public class FloatingValuesController : MonoBehaviour { public GameObject floatingValueUiPrefab; public Transform canvasParent; void OnEnable() { DamageEvents.OnDamage += OnDamage; DamageEvents.OnHeal += OnHeal; FloatingMessageEvents.OnMessage += OnMessage; } void OnDisable() { DamageEvents.OnDamage -= OnDamage; DamageEvents.OnHeal -= OnHeal; FloatingMessageEvents.OnMessage -= OnMessage; } private void OnDamage(DamageData damageData) { GameObject obj = Instantiate(floatingValueUiPrefab, canvasParent); obj.GetComponent().Setup(damageData.damageController.transform.position, "-" + damageData.damage.ToString()); } private void OnHeal(DamageController damageController, int heal) { GameObject obj = Instantiate(floatingValueUiPrefab, canvasParent); obj.GetComponent().Setup(damageController.transform.position, "+" + heal.ToString()); } private void OnMessage(string message, Vector3 pos, float offset, float time, float fontSize) { GameObject obj = Instantiate(floatingValueUiPrefab, canvasParent); obj.GetComponent().Setup(pos, message, 1.2f); } } }