Fiore b9a014df88 [refact] 도망 로직 개선, 코루틴 최적화
- 몬스터가 텔레포트로 도망칠 위치를 에디터에서 수정할 수 있도록 개선
- 플레이어와 거리 계산 최적화
- 코루틴에서 사용하는 WaitForSecond 객체 캐싱 유틸 추가

Work in JIRA ISSUE #DEG-100
2025-05-07 14:27:29 +09:00

18 lines
460 B
C#

using System.Collections.Generic;
using UnityEngine;
// 코루틴의 WaitForSeconds를 캐싱하는 유틸
public static class Wait
{
private static readonly Dictionary<float, WaitForSeconds> _waits = new();
public static WaitForSeconds For(float seconds)
{
if (!_waits.TryGetValue(seconds, out var wait))
{
wait = new WaitForSeconds(seconds);
_waits[seconds] = wait;
}
return wait;
}
}