| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class BuffController : MonoBehaviour
- {
- private MoveCharacter owner;
- public List<BuffBase> buffList;
- private void Awake()
- {
- owner = GetComponent<MoveCharacter>();
- }
- private void OnEnable()
- {
- buffList = new List<BuffBase>();
- }
- public void AddBuff(BuffBase buff)
- {
- buffList.Add(buff);
- buff.AddBuff(owner);
- //Debug.Log("Ìî¼Óbuff");
- }
- public void RemoveBuff(BuffBase buff)
- {
- buffList.Remove(buff);
- buff.RemoveBuff(owner);
- //Debug.Log("ÒÆ³ýbuff");
- }
- private void OnDisable()
- {
- foreach(BuffBase buff in buffList)
- {
- buff.RemoveBuff(owner);
- }
- buffList.Clear();
- }
- }
|