+ Title Ui 수정 + 전투 맵 이동 위치 수정 + 맵 입구 이미지 변경 + 풀잎 아이템 추가에 따른 Excel, Json, So 수정 + 타이탄 슬라임 맵에서 풀이 잘릴 때, 40% 확률로 풀잎을 드롭 + 타이탄 슬라임 젬스톤 위치 및 재질 변경 + AutoDropItem 프리팹 추가
71 lines
1.9 KiB
C#
71 lines
1.9 KiB
C#
using System.Collections;
|
|
using BlueWater.Audios;
|
|
using BlueWater.Items;
|
|
using BlueWater.Players;
|
|
using BlueWater.Utility;
|
|
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 Coroutine _touchCoroutineInstance;
|
|
|
|
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;
|
|
|
|
Utils.StartUniqueCoroutine(this, ref _touchCoroutineInstance, TouchCoroutine());
|
|
}
|
|
|
|
private IEnumerator TouchCoroutine()
|
|
{
|
|
var touchTrack = _spineController.PlayAnimation(_touchAnimationName, false);
|
|
while (!touchTrack.IsComplete)
|
|
{
|
|
if (CurrentHealthPoint == 0) yield break;
|
|
|
|
yield return null;
|
|
}
|
|
_spineController.PlayAnimation(_idleAnimationName, true);
|
|
}
|
|
|
|
public override void Die()
|
|
{
|
|
if (!string.IsNullOrEmpty(DieSfxName))
|
|
{
|
|
AudioManager.Instance.PlaySfx(DieSfxName);
|
|
}
|
|
|
|
_spineController.PlayAnimation(_dieAnimationName, false);
|
|
|
|
if (CharacterIdx != 0)
|
|
{
|
|
ItemManager.Instance.ItemDropRandomPosition(CharacterIdx, transform.position, 0f);
|
|
}
|
|
}
|
|
}
|
|
} |