Danro/Assets/Scripts/Behaviour/Animations/PayerAnimationEvents.cs

48 lines
1.2 KiB
C#

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<Rigidbody2D>();
_collider = GetComponent<Collider2D>();
}
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);
}
}