55 lines
2.4 KiB (Stored with Git LFS)
C#
55 lines
2.4 KiB (Stored with Git LFS)
C#
using Spine;
|
|
using UnityEngine;
|
|
|
|
namespace DDD
|
|
{
|
|
public static class RestaurantSpineAnimation
|
|
{
|
|
public const string Idle = "Idle";
|
|
public const string Walking = "RunFast";
|
|
public const string ServingIdle = "Serving/ServingIdle";
|
|
public const string Serving = "Serving/ServingFast";
|
|
public const string Dash = "Dash";
|
|
public const string CleaningFloor = "Cleaning/CleaningFloor";
|
|
public const string CleaningTable = "Cleaning/CleaningTable";
|
|
public const string MakingCocktail = "BeerMaker";
|
|
public const string Pumping = "Attack/AttackWhip";
|
|
public const string AttackSlime = "Attack/AttackSlime";
|
|
public const string AttackLimeTree = "Attack/AttackBat";
|
|
public const string CookingFried = "Cooking/CookingFried";
|
|
public const string CookingStew = "Cooking/CookingStew";
|
|
}
|
|
|
|
public class RestaurantPlayerView : MonoBehaviour
|
|
{
|
|
private Rigidbody _rigidbody;
|
|
private Transform _visualLook;
|
|
private ParticleSystem _dashParticle;
|
|
private SpineController _spineController;
|
|
|
|
private void Awake()
|
|
{
|
|
_rigidbody = GetComponent<Rigidbody>();
|
|
_visualLook = transform.Find("VisualLook");
|
|
}
|
|
|
|
public void SetVelocity(Vector3 velocity) => _rigidbody.linearVelocity = velocity;
|
|
public Vector3 GetLocalScale() => _visualLook.localScale;
|
|
public void SetLocalScale(Vector3 localScale) => _visualLook.localScale = localScale;
|
|
|
|
public void PlayDashParticle()
|
|
{
|
|
if (_dashParticle)
|
|
{
|
|
_dashParticle.Play();
|
|
}
|
|
}
|
|
|
|
public TrackEntry PlayAnimation(string animationName, bool isLoopActive, float speed = 1f, bool isReverse = false, int trackIndex = 0)
|
|
=> _spineController.PlayAnimation(animationName, isLoopActive, speed, isReverse, trackIndex);
|
|
public TrackEntry PlayAnimationDuration(string animationName, bool isLoopActive, float duration, bool isReverse = false, int trackIndex = 0) =>
|
|
_spineController.PlayAnimationDuration(animationName, isLoopActive, duration, isReverse, trackIndex);
|
|
public TrackEntry AddAnimation(string animationName, bool isLoopActive, int trackIndex = 0)
|
|
=> _spineController.AddAnimation(animationName, isLoopActive, trackIndex);
|
|
}
|
|
} |