using System.Collections; using System.Collections.Generic; using UnityEngine; public class EffectAplier : MonoBehaviour { // Start is called before the first frame update [SerializeField] private List<EffectBase> effect = new List<EffectBase>(); public bool canApply = false; private void OnCollisionEnter(Collision collision) { if (canApply) { IEffectsHandler handler = collision.gameObject.GetComponent<IEffectsHandler>(); if (handler != null) { foreach (EffectBase e in effect) { handler.ApplyEffect(e, gameObject); } Destroy(gameObject); } } } }