2025-08-18 10:48:36 +00:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace DDD
|
|
|
|
{
|
2025-08-19 08:13:34 +00:00
|
|
|
[RequireComponent(typeof(RestaurantPlayerMovement))]
|
2025-08-18 10:48:36 +00:00
|
|
|
public class RestaurantPlayerAnimation : RestaurantCharacterAnimation
|
|
|
|
{
|
|
|
|
private RestaurantPlayerMovement _restaurantPlayerMovement;
|
|
|
|
|
|
|
|
protected override void Awake()
|
|
|
|
{
|
|
|
|
base.Awake();
|
|
|
|
|
|
|
|
_restaurantPlayerMovement = GetComponent<RestaurantPlayerMovement>();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Start()
|
|
|
|
{
|
|
|
|
base.Start();
|
|
|
|
|
|
|
|
_restaurantPlayerMovement.OnMoving += OnMove;
|
|
|
|
_restaurantPlayerMovement.OnDashing += OnDash;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnDestroy()
|
|
|
|
{
|
|
|
|
base.OnDestroy();
|
|
|
|
|
|
|
|
if (_restaurantPlayerMovement)
|
|
|
|
{
|
|
|
|
_restaurantPlayerMovement.OnMoving -= OnMove;
|
|
|
|
_restaurantPlayerMovement.OnDashing -= OnDash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnMove(bool isMoving)
|
|
|
|
{
|
|
|
|
string animationName = isMoving ? RestaurantPlayerAnimationType.Walk : RestaurantPlayerAnimationType.Idle;
|
|
|
|
_spineController.PlayAnimation(animationName, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnDash(float dashTime)
|
|
|
|
{
|
|
|
|
_spineController.PlayAnimationDuration(RestaurantPlayerAnimationType.Dash, false, duration:dashTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|