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

24 lines
639 B
C#

using RR.Game2D.Behaviour;
using RR.Game2D.Core;
using UnityEngine;
public class PlayerAnimationEvents : MonoBehaviour
{
private PlayerController _controller;
private Rigidbody2D _rb;
private void Awake()
{
_controller = GetComponent<PlayerController>();
_rb = GetComponent<Rigidbody2D>();
}
public void OnDeathEnd()
{
Animator animator = GetComponent<Animator>();
animator.ResetTrigger("Death");
gameObject.layer = LayerMask.NameToLayer("Default");
_rb.constraints = RigidbodyConstraints2D.FreezeRotation;
GameManager.Instance.RespawnPlayer();
}
}