17 lines
428 B
C#
17 lines
428 B
C#
|
|
using UnityEngine;
|
|||
|
|
using System;
|
|||
|
|
|
|||
|
|
public static class AnimatorExtensions {
|
|||
|
|
|
|||
|
|
/// GetBehaviourで取得出来ればfuncに渡す
|
|||
|
|
public static bool FindBehaviour<T>(this Animator t, Action<T> func) where T : StateMachineBehaviour {
|
|||
|
|
T behaviour = t.GetBehaviour<T>();
|
|||
|
|
if(behaviour != null){
|
|||
|
|
func(behaviour);
|
|||
|
|
return true;
|
|||
|
|
}else{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|