using System; using System.Collections; using System.Collections.Generic; using DamageNumbersPro; using DarkTonic.MasterAudio; using DragonLi.Core; using DragonLi.Frame; using Mirror; using UnityEngine; public class DamageBox : MonoBehaviour, IDamagable { public float Health { get; set; } public bool isDie; [SoundGroup] public string audioSound; private void Start() { isDie = false; } /// /// Implemenet this function to receive damage /// /// /// /// public void ApplyDamage(float value, object info, Transform _sender) { DamageNumber prefab = MRDamage.Ins.GetCurrent(); DamageNumber newDamageNumber = prefab.Spawn(_sender.position, value); if (Health <= 0&& !isDie) { isDie = true; //破碎效果 MasterAudio.PlaySound3DAtTransform(audioSound, transform); CoroutineTaskManager.Instance.WaitSecondTodo(() => { gameObject.SetActive(false); }, 2f); } } }