연속 액션 기능 및 관련 설정 기능 추가
This commit is contained in:
@@ -44,11 +44,36 @@ public class PlayerActionHandler : NetworkBehaviour
|
||||
private IEnumerator ActionRoutine(PlayerActionData data, GameObject target)
|
||||
{
|
||||
_isBusy = true;
|
||||
_animator.SetTrigger(data.animTrigger);
|
||||
|
||||
data.ExecuteEffect(gameObject, target); // 로직 실행
|
||||
// 1. 애니메이션 재생 속도 결정
|
||||
// (나중에 캐릭터 스탯이나 버프에 따라 이 값을 추가로 계산할 수 있습니다)
|
||||
float finalSpeed = data.baseSpeed;
|
||||
_animator.SetFloat("ActionSpeed", finalSpeed);
|
||||
|
||||
// 2. 애니메이션 실행
|
||||
if (!string.IsNullOrEmpty(data.animTrigger))
|
||||
_animator.SetTrigger(data.animTrigger);
|
||||
|
||||
// 3. 속도에 맞춰 보정된 타격 지연 시간 계산
|
||||
// 공식: 실제 대기 시간 = 설정된 지연 시간 / 재생 속도
|
||||
float adjustedImpactDelay = data.impactDelay / finalSpeed;
|
||||
yield return new WaitForSeconds(adjustedImpactDelay);
|
||||
|
||||
// 4. 타격 효과 실행
|
||||
if (target != null)
|
||||
{
|
||||
data.ExecuteEffect(gameObject, target);
|
||||
}
|
||||
|
||||
// 5. 속도에 맞춰 보정된 나머지 시간 계산
|
||||
float adjustedTotalDuration = data.duration / finalSpeed;
|
||||
float remainingTime = adjustedTotalDuration - adjustedImpactDelay;
|
||||
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
yield return new WaitForSeconds(remainingTime);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(data.duration);
|
||||
_isBusy = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user