1
This commit is contained in:
@@ -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:
|
||||
Reference in New Issue
Block a user