DDD-62 플레이어 무브먼트 컨스트레인 체크 추가

This commit is contained in:
Jeonghyeon Ha 2025-07-17 15:38:50 +09:00
parent 929f7ecf55
commit a3cf0c1804
5 changed files with 54 additions and 2 deletions

View File

@ -0,0 +1,7 @@
namespace DDD
{
public interface IRestaurantMovementConstraint
{
public bool IsBlockingMovement();
}
}

View File

@ -38,5 +38,11 @@ private void OnDash(float dashTime)
{
_spineController.PlayAnimationDuration(RestaurantPlayerAnimation.Dash, false, duration:dashTime);
}
public bool IsPlayingAnimation()
{
// TODO : Implement this
return false;
}
}
}

View File

@ -4,6 +4,25 @@ namespace DDD
{
public class RestaurantCharacterMovement : MonoBehaviour
{
private RestaurantCharacterMovementConstraint _constraint;
private void Awake()
{
_constraint = gameObject.AddComponent<RestaurantCharacterMovementConstraint>();
}
public virtual bool CanMove()
{
// Get all components implements IRestaurantMovementConstraint
var constraints = GetComponents<IRestaurantMovementConstraint>();
// TODO : Maybe need optimize GetComponents?
foreach (var movementConstraint in constraints)
{
if (movementConstraint.IsBlockingMovement())
{
return false;
}
}
return true;
}
}
}

View File

@ -0,0 +1,17 @@
using UnityEngine;
namespace DDD
{
public class RestaurantCharacterMovementConstraint : MonoBehaviour, IRestaurantMovementConstraint
{
public bool IsBlockingMovement()
{
if (GetComponent<RestaurantCharacterAnimation>().IsPlayingAnimation())
{
return true;
}
return false;
}
}
}

View File

@ -118,7 +118,10 @@ private void HandleMovement()
}
}
private bool CanMove() => _playerDataSo.IsMoveEnabled && !_isDashing;
public override bool CanMove()
{
return base.CanMove() && _playerDataSo.IsMoveEnabled && !_isDashing;
}
private void Move()
{