+ BaseSpineProps 스파인을 기반으로 사용되는 Props 프리팹 + SpineDamageablesProps 공격을 받을 수 있는 스파인 기반 Props 클래스 추가 + 타이탄 슬라임 맵 테스트용 배치 Closes #28
56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
using BlueWater.Audios;
|
|
using BlueWater.Players;
|
|
using UnityEngine;
|
|
|
|
namespace BlueWater
|
|
{
|
|
public class SpineDamageableProps : DamageableProps
|
|
{
|
|
[SerializeField]
|
|
private SpineController _spineController;
|
|
|
|
[SerializeField]
|
|
private string _idleAnimationName;
|
|
|
|
[SerializeField]
|
|
private string _touchAnimationName;
|
|
|
|
[SerializeField]
|
|
private string _dieAnimationName;
|
|
|
|
private void Awake()
|
|
{
|
|
_spineController = GetComponent<SpineController>();
|
|
}
|
|
|
|
protected override void OnEnable()
|
|
{
|
|
base.OnEnable();
|
|
_spineController.PlayAnimation(_idleAnimationName, true);
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (!other.CompareTag("Player") || CurrentHealthPoint <= 0) return;
|
|
|
|
_spineController.PlayAnimation(_touchAnimationName, false);
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if (!other.CompareTag("Player") || CurrentHealthPoint <= 0) return;
|
|
|
|
_spineController.PlayAnimation(_idleAnimationName, true);
|
|
}
|
|
|
|
public override void Die()
|
|
{
|
|
if (!string.IsNullOrEmpty(DieSfxName))
|
|
{
|
|
AudioManager.Instance.PlaySfx(DieSfxName);
|
|
}
|
|
|
|
_spineController.PlayAnimation(_dieAnimationName, false);
|
|
}
|
|
}
|
|
} |