using UnityEngine; using RR.Game2D.Behaviour; public class EnemyAnimationEvents : MonoBehaviour { public void OnDeathBegin() { gameObject.layer = LayerMask.NameToLayer("No Collision"); Rigidbody2D rb = GetComponent(); Collider2D col = GetComponent(); EnemyController controller = GetComponent(); if (controller) controller.enabled = false; if (col) col.enabled = false; if (!rb) return; rb.linearVelocity = Vector2.zero; rb.bodyType = RigidbodyType2D.Kinematic; } public void OnDeathEnd() { Destroy(gameObject); } }