using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Assertions; using UnityAtoms.BaseAtoms; using UnityAtoms; using UnityAtoms.Tags; public class DecreaseHealth : MonoBehaviour { [SerializeField] private IntReference _decreaseBy; [SerializeField] private List _tags; [SerializeField] private VoidBaseEventReference _didCollide; void Start() { Assert.IsNotNull(_decreaseBy); Assert.IsNotNull(_tags); } public void Do(Collider2D collider) { if (collider.gameObject.HasAnyTag(_tags)) { collider.GetComponent().Health -= _decreaseBy; } if (_didCollide != null && _didCollide.Event != null) { _didCollide.Event.Raise(); } } }