This commit is contained in:
MuHua-123
2025-03-11 23:45:41 +08:00
parent a86e32c89e
commit 9f56eff9c0
48 changed files with 319 additions and 158 deletions
@@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
public class AnimatorStandard : IAnimator {
private string layer;
private string current;
private Animator animator;
private void Awake() => animator = GetComponent<Animator>();
public override void Transition(string name) {
if (current == name) { animator.Play(name); }
else { animator.CrossFade(name, 0.1f); }
current = name;
// 判断当前动画,如果不是相同动画就增加过渡
// AnimatorStateInfo currentState = animator.GetCurrentAnimatorStateInfo(0);
// Debug.Log($"{currentState.normalizedTime} , {this.kinesis.AnimName}");
}
public override void SetFloat(string name, float value) => animator.SetFloat(name, value);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8394161d0e9670f4a83246f5a5da722b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
[RequireComponent(typeof(Animator))]
public abstract class IAnimator : MonoBehaviour {
/// <summary> 动画过渡 </summary>
public abstract void Transition(string name);
/// <summary> 设置参数 </summary>
public abstract void SetFloat(string name, float value);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e64668e8630d6c149bd637156aa1c42d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: