Files
Continentis/Assets/Scripts/MainGame/Character/CharacterView/SpineAnimator.cs
SoulliesOfficial c3b1561375 更新
2026-04-01 12:23:27 -04:00

53 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using UnityEngine;
namespace Continentis.MainGame.Character
{
/// <summary>
/// Tier 3 动画驱动器Spine 骨骼动画(预留接口)。
/// 美术资源到位后,接入 Spine-Unity Runtime 的 SkeletonAnimation API。
///
/// 预期实现思路:
/// - InitializeAnimator获取 SkeletonAnimation 引用,设置 Idle 动画
/// - PlayAction调用 SkeletonAnimation.AnimationState.SetAnimation()
/// - 利用 Spine 事件系统触发攻击命中帧、特效帧等
/// - 支持动画混合(如上半身攻击 + 下半身移动)
/// </summary>
public class SpineAnimator : MonoBehaviour, ICharacterAnimator
{
// TODO: Spine Runtime 引用
// private SkeletonAnimation _skeleton;
public void InitializeAnimator(CombatCharacterViewBase view)
{
Debug.LogWarning("[SpineAnimator] Spine 动画驱动器尚未实装,当前为占位。");
// TODO: 获取 SkeletonAnimation 组件
// _skeleton = view.mainView.GetComponent<SkeletonAnimation>();
// _skeleton.AnimationState.SetAnimation(0, "idle", true);
}
public void PlayAction(string actionName, float speed = 1f, Action onComplete = null)
{
Debug.LogWarning($"[SpineAnimator] PlayAction('{actionName}') 未实装。");
// TODO:
// var entry = _skeleton.AnimationState.SetAnimation(0, actionName, false);
// entry.TimeScale = speed;
// entry.Complete += _ => {
// _skeleton.AnimationState.SetAnimation(0, "idle", true);
// onComplete?.Invoke();
// };
onComplete?.Invoke();
}
public void ReturnToIdle()
{
// TODO: _skeleton.AnimationState.SetAnimation(0, "idle", true);
}
public void SetPause(bool isPaused)
{
// TODO: _skeleton.timeScale = isPaused ? 0f : 1f;
}
}
}