action 애니메이션 처리

This commit is contained in:
NTG 2025-09-02 15:49:34 +09:00
parent c81db280b6
commit fa6746b93e
4 changed files with 28 additions and 40 deletions

View File

@ -59,8 +59,8 @@ public interface IInteractor
bool CanSolveInteractionType(InteractionType interactionType);
bool FetchSolverTypeForInteraction(InteractionType type, out Type solverType);
bool IsInteractionHidden(IInteractable interactable);
bool CanInteractTo(IInteractable interactable,
ScriptableObject payloadSo = null);
bool CanInteractTo(IInteractable interactable, ScriptableObject payloadSo = null);
bool IsInteracting();
}
public interface IInteractionSolver

View File

@ -1,12 +1,10 @@
using System;
using Sirenix.OdinInspector;
using UnityEngine;
namespace DDD.Restaurant
{
[RequireComponent(typeof(CharacterInteraction))]
[RequireComponent(typeof(SpineController))]
public class RestaurantCharacter : MonoBehaviour, IGameCharacter, IInteractor
public class RestaurantCharacter : MonoBehaviour, IGameCharacter
{
CharacterInteraction _interactionComponent;
protected SpineController _spineController;
@ -22,35 +20,5 @@ protected virtual void Start()
{
}
public GameObject GetInteractorGameObject()
{
return _interactionComponent.GetInteractorGameObject();
}
public IInteractable GetFocusedInteractable()
{
return _interactionComponent.GetFocusedInteractable();
}
public bool CanSolveInteractionType(InteractionType interactionType)
{
return _interactionComponent.CanSolveInteractionType(interactionType);
}
public bool FetchSolverTypeForInteraction(InteractionType type, out Type solverType)
{
return _interactionComponent.FetchSolverTypeForInteraction(type, out solverType);
}
public bool IsInteractionHidden(IInteractable interactable)
{
return _interactionComponent.IsInteractionHidden(interactable);
}
public bool CanInteractTo(IInteractable interactable, ScriptableObject payloadSo = null)
{
return _interactionComponent.CanInteractTo(interactable, payloadSo);
}
}
}

View File

@ -27,7 +27,9 @@ public enum PlayerDefaultAnimationState
[RequireComponent(typeof(PlayerMovement))]
public class PlayerAnimation : CharacterAnimation
{
private IInteractor _interactor;
private IMovementState _movementState;
private PlayerTaskAnimationState _currentTaskAnimationState = PlayerTaskAnimationState.None;
private PlayerActionAnimationState _currentActionAnimationState = PlayerActionAnimationState.None;
private PlayerDefaultAnimationState _currentDefaultAnimationState = PlayerDefaultAnimationState.None;
@ -52,6 +54,7 @@ protected override void Awake()
{
base.Awake();
_interactor = GetComponent<IInteractor>();
_movementState = GetComponent<IMovementState>();
}
@ -94,7 +97,11 @@ private void UpdateAnimations()
// 2순위: ActionState 체크
var desiredActionState = GetDesiredActionState();
if (desiredActionState != PlayerActionAnimationState.None)
if (desiredActionState == PlayerActionAnimationState.None)
{
_currentActionAnimationState = PlayerActionAnimationState.None;
}
else
{
if (_currentActionAnimationState != desiredActionState)
{
@ -141,8 +148,16 @@ private async Task PlayTaskAnimation(PlayerTaskAnimationState state, float durat
private PlayerActionAnimationState GetDesiredActionState()
{
// 여기서 현재 액션 상태를 확인하는 로직 구현
// 예: 상호작용 컴포넌트에서 상태 가져오기
if (_interactor.IsInteracting() == false) return PlayerActionAnimationState.None;
var interactable = _interactor.GetFocusedInteractable();
if (interactable == null) return PlayerActionAnimationState.None;
var interactionType = interactable.GetInteractionType();
if (interactionType == InteractionType.RestaurantTrash) // TODO : 서브시스템 연결해서 테이블청소 연결해야함
{
return PlayerActionAnimationState.CleaningTable;
}
return PlayerActionAnimationState.None;
}

View File

@ -197,8 +197,13 @@ public override bool FetchSolverTypeForInteraction(InteractionType type, out Typ
return base.FetchSolverTypeForInteraction(type, out solverType);
}
public override bool IsInteracting() => _isInteracting;
public override bool IsInteracting()
{
if (base.IsInteracting() == false) return false;
return _isInteracting;
}
public override float GetMovementSpeedMultiplier()
{