using System; using RR.Game2D.Behaviour; using UnityEngine; public class PayerAnimationEvents : MonoBehaviour { private Rigidbody2D _rigidbody; private Collider2D _collider; private PlayerController _controller; private void Awake() { _rigidbody = GetComponent(); _collider = GetComponent(); } public void OnDeathBegin() { if (_collider) _collider.isTrigger = true; if (!_rigidbody) return; _rigidbody.linearVelocity = Vector2.zero; // _rigidbody.bodyType = RigidbodyType2D.Kinematic; } // private void OnDeathByEnemy() // { // // Custom logic for when the player dies by an enemy // Debug.Log("Player has died by an enemy."); // } // // private void OnDeathByHazard() // { // // Custom logic for when the player dies by a hazard // Debug.Log("Player has died by a hazard."); // } // // private void OnDeathByVoid() // { // // Custom logic for when the player dies by falling into the void // Debug.Log("Player has died by falling into the void."); // } public void OnDeathEnd() { Destroy(gameObject); } }