48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using UnityEngine;
|
|
|
|
namespace DDD
|
|
{
|
|
public class RestaurantCharacterAnimation : MonoBehaviour
|
|
{
|
|
private RestaurantPlayerMovement _restaurantPlayerMovement;
|
|
private SpineController _spineController;
|
|
|
|
private void Awake()
|
|
{
|
|
_restaurantPlayerMovement = GetComponent<RestaurantPlayerMovement>();
|
|
_spineController = GetComponent<SpineController>();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
_restaurantPlayerMovement.OnMoving += OnMove;
|
|
_restaurantPlayerMovement.OnDashing += OnDash;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
if (_restaurantPlayerMovement)
|
|
{
|
|
_restaurantPlayerMovement.OnMoving -= OnMove;
|
|
_restaurantPlayerMovement.OnDashing -= OnDash;
|
|
}
|
|
}
|
|
|
|
private void OnMove(bool isMoving)
|
|
{
|
|
string animationName = isMoving ? RestaurantPlayerAnimation.Walk : RestaurantPlayerAnimation.Idle;
|
|
_spineController.PlayAnimation(animationName, true);
|
|
}
|
|
|
|
private void OnDash(float dashTime)
|
|
{
|
|
_spineController.PlayAnimationDuration(RestaurantPlayerAnimation.Dash, false, duration:dashTime);
|
|
}
|
|
|
|
public bool IsPlayingAnimation()
|
|
{
|
|
// TODO : Implement this
|
|
return false;
|
|
}
|
|
}
|
|
} |