Compare commits

...

2 Commits

Author SHA1 Message Date
Jeonghyeon Ha
0f0c7019c2 updated metadata 2025-07-17 15:39:00 +09:00
Jeonghyeon Ha
a3cf0c1804 DDD-62 플레이어 무브먼트 컨스트레인 체크 추가 2025-07-17 15:38:50 +09:00
7 changed files with 60 additions and 2 deletions

View File

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

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 59144c6942834360adc33f456812201c
timeCreated: 1752733543

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

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3af7fa0aab2d45b19f78c34b028732b3
timeCreated: 1752733503

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()
{