34 lines
1010 B
C#
34 lines
1010 B
C#
using RR.Common.Managers;
|
|
using RR.Game2D.Behaviour;
|
|
using RR.Game2D.Core.Managers;
|
|
using UnityEngine;
|
|
|
|
public class PlayerAnimationEvents : MonoBehaviour
|
|
{
|
|
[SerializeField] private AudioClip deathSound;
|
|
|
|
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();
|
|
}
|
|
|
|
public void PlaySfx(AudioClip sound)
|
|
{
|
|
// Debug.Log($"StepSound: {stepSound}");
|
|
if (sound != null) GameManager.Instance.Audio.PlaySfxAt(sound, transform.position, 0.5f);
|
|
// AudioManager.Instance.PlaySfxAt(stepSound, transform.position);
|
|
}
|
|
} |