+ Item관련 Excel, Json, So 수정 + DropItemTable 로직 수정 + 아이템 프리팹에서 Enable Interaction 체크하면 직접 룻팅, 해제하면 자동 룻팅 + 체력회복 아이템 추가 + 개발자 메뉴 상호작용 "F1" 키를 통해 접근 가능 + 보스 맵은 마법진을 상호작용하면 보스전 시작 + 맵 안에서 교전 중일 때, 투명 벽 쉐이더 추가 + 맵 마다의 통로를 통해서 이동 가능 + 선형적인 맵 구조에 맞게 리소스 및 위치 수정 + 타이틀 화면으로 이동할 때 나타나는 오류 수정(CombatUiManager OnDisable 싱글톤 문제) Closes #25, #26
88 lines
2.7 KiB
C#
88 lines
2.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using BlueWater.Players;
|
|
using BlueWater.Utility;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
namespace BlueWater.Maps
|
|
{
|
|
public class BossMapTrigger : MonoBehaviour
|
|
{
|
|
public enum BossMapTriggerAnimation
|
|
{
|
|
Idle,
|
|
Animation
|
|
}
|
|
|
|
[SerializeField]
|
|
private SpineController _spineController;
|
|
|
|
public Action OnInteractionActive;
|
|
private Coroutine _bossMapTriggerCoroutineInstance;
|
|
|
|
private void Awake()
|
|
{
|
|
InitializeComponents();
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (!other.CompareTag("Player")) return;
|
|
|
|
Utils.StartUniqueCoroutine(this, ref _bossMapTriggerCoroutineInstance, BossMapTriggerCoroutine());
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if (!other.CompareTag("Player")) return;
|
|
|
|
if (_bossMapTriggerCoroutineInstance == null) return;
|
|
|
|
StopCoroutine(_bossMapTriggerCoroutineInstance);
|
|
_bossMapTriggerCoroutineInstance = null;
|
|
_spineController.PlayAnimation(BossMapTriggerAnimation.Idle.ToString(), true);
|
|
}
|
|
|
|
[Button("컴포넌트 초기화")]
|
|
private void InitializeComponents()
|
|
{
|
|
_spineController = GetComponent<SpineController>();
|
|
}
|
|
|
|
public void ResetTrigger()
|
|
{
|
|
_spineController.PlayAnimation(BossMapTriggerAnimation.Idle.ToString(), true);
|
|
if (_bossMapTriggerCoroutineInstance != null)
|
|
{
|
|
StopCoroutine(_bossMapTriggerCoroutineInstance);
|
|
_bossMapTriggerCoroutineInstance = null;
|
|
}
|
|
gameObject.SetActive(true);
|
|
}
|
|
|
|
private IEnumerator BossMapTriggerCoroutine()
|
|
{
|
|
var interactionAnimationName = BossMapTriggerAnimation.Animation.ToString();
|
|
_spineController.PlayAnimation(interactionAnimationName, false);
|
|
|
|
var animationStarted = false;
|
|
yield return StartCoroutine(_spineController.WaitForAnimationToRun(interactionAnimationName,
|
|
success => animationStarted = success));
|
|
|
|
if (!animationStarted)
|
|
{
|
|
yield break;
|
|
}
|
|
|
|
while (_spineController.IsComparingCurrentAnimation(interactionAnimationName)
|
|
&& _spineController.GetCurrentAnimationNormalizedTime() <= 1f)
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
gameObject.SetActive(false);
|
|
OnInteractionActive?.Invoke();
|
|
}
|
|
}
|
|
} |