本文整理汇总了C#中Animator.GetCurrentAnimatorClipInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Animator.GetCurrentAnimatorClipInfo方法的具体用法?C# Animator.GetCurrentAnimatorClipInfo怎么用?C# Animator.GetCurrentAnimatorClipInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animator
的用法示例。
在下文中一共展示了Animator.GetCurrentAnimatorClipInfo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStateExit
//OnStateExit is called before OnStateExit is called on any state inside this state machine
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
AnimatorClipInfo aci = animator.GetCurrentAnimatorClipInfo(layerIndex)[0];
Debug.Log("离开:" + aci.clip.name + "-" + stateInfo.fullPathHash + "-" + stateInfo.length + "-" + stateInfo.normalizedTime + "-" + (stateInfo.normalizedTime - prev));
//Debug.Log(3 + "-" + stateInfo.fullPathHash + "-" + stateInfo.length + "-" + stateInfo.normalizedTime + "-" + (stateInfo.normalizedTime - prev));
prev = stateInfo.normalizedTime;
}
示例2: IsAnimationPlaying
/// <summary>
/// Returns true when the current current animation is playing.
/// </summary>
/// <param name="name">name of animation</param>
/// <param name="animator">animator object</param>
/// <returns></returns>
public static bool IsAnimationPlaying(string name, Animator animator)
{
for (int i = 0; i < animator.layerCount; i++)
{
AnimatorClipInfo[] clipInfoArray = animator.GetCurrentAnimatorClipInfo(i);
foreach (AnimatorClipInfo info in clipInfoArray) if (info.clip.name.Equals(name)) return true;
}
return false;
}
示例3: Start
// Use this for initialization
void Start()
{
sktAnimator = GetComponent<SkeletonAnimator>();
if (sktAnimator == null)
{
Debug.LogError("sktAnimator == null");
}
else
{
sktAnimator.GetSkeleton().flipX = true;
sktAnimator.GetSkeleton().SetColor(new Color(1.0f, 0.0f, 0.0f));
}
sktAnimation = GetComponent<SkeletonAnimation>();
if (sktAnimation == null)
{
Debug.LogError("sktAnimation == null");
}
else
{
Debug.Log("animation : " + sktAnimation.state.GetCurrent(0));
}
animator = GetComponent<Animator>();
if (animator == null)
{
Debug.LogError("animator == null");
}
else
{
AnimatorClipInfo[] items = animator.GetCurrentAnimatorClipInfo(0);
Debug.Log("items length : " + items.Length);
foreach (AnimatorClipInfo item in items)
{
Debug.Log("" + item.clip.name);
}
Debug.Log("ok");
// Debug.Log ("animator : " + animator.GetComponent<UnityEngine.Animation>().name);
}
sktUtility = GetComponent<SkeletonUtility>();
if (sktUtility == null)
{
Debug.LogError ("sktUtility == null");
}
else
{
Debug.Log ("123123" + sktUtility.skeletonAnimation.Skeleton.Slots);
// foreach (Slot item in sktUtility.skeletonAnimation.Skeleton.Slots)
// {
// Debug.Log ("item : " + item.ToString());
// if (item.ToString().Equals("front_bracer"))
// {
// item.SetColor(new Color(0.0f, 1.0f, 0.0f));
// }
// }
}
}
示例4: OnStateEnter
// OnStateEnter is called before OnStateEnter is called on any state inside this state machine
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Debug.Log(1 + "-" + stateInfo.fullPathHash + "-" + Animator.StringToHash("Base.Idle.idle1")+"-"+ stateInfo.length + "-" + stateInfo.normalizedTime + "-" + (stateInfo.normalizedTime - prev));
prev = stateInfo.normalizedTime;
// animationManager.initState(animator, stateInfo);
AnimationEvent ae = new AnimationEvent();
ae.functionName = "animationEvent";
AnimatorTransitionInfo ati = animator.GetAnimatorTransitionInfo(layerIndex);
AnimatorClipInfo aci = animator.GetCurrentAnimatorClipInfo(layerIndex)[0];
aci.clip.AddEvent(ae);
Debug.Log( "进入:"+ aci.clip.name +"-"+ stateInfo.fullPathHash + "-" + stateInfo.length + "-" + stateInfo.normalizedTime + "-" + (stateInfo.normalizedTime - prev));
//animator.SetInteger("idle",Random.Range(1, 3));
//AnimationAction animationAction = AnimationManager.getAnimationAction(animator);
}
示例5: OnStateUpdate
// OnStateUpdate is called before OnStateUpdate is called on any state inside this state machine
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Debug.Break();
AnimatorTransitionInfo ati = animator.GetAnimatorTransitionInfo(layerIndex);
AnimatorClipInfo []acis = animator.GetCurrentAnimatorClipInfo(layerIndex);
string acit = "";
foreach (AnimatorClipInfo aci in acis){
acit += "["+aci.weight + ":" + aci.clip.name+"],";
}
//Debug.Log(2 + "-[" + ati.normalizedTime + "]-["+animator.GetCurrentAnimatorClipInfo(layerIndex)[0].clip.name+ "]-["+stateInfo.normalizedTime+"]-"+ (stateInfo.normalizedTime-prev));
prev = stateInfo.normalizedTime;
Debug.Log("update:" + stateInfo.fullPathHash+"-"+acit+stateInfo.normalizedTime);
if (stateInfo.normalizedTime>0.8f)
{
// Debug.Log(stateInfo.fullPathHash);
//animator.SetInteger("Attack", 0);
//Debug.Break();
}
}
示例6: _AnimateFantasy
private IEnumerator _AnimateFantasy()
{
m_fantasyModel = GameObject.Find("FantasyCharacter").GetComponent<Animator>();
m_fantasyModel.SetBool("IdleToIdle", false);
m_fantasyModel.SetBool("AttackToIdle", false);
m_fantasyModel.SetBool("IdleToAttack", true);
yield return new WaitForSeconds(0.3f);
float animationLength = m_fantasyModel.GetCurrentAnimatorClipInfo(0)[0].clip.length;
yield return new WaitForSeconds(animationLength - 0.2f);
m_fantasyModel.SetBool("IdleToIdle", true);
m_fantasyModel.SetBool("IdleToAttack", false);
m_fantasyModel.SetBool("AttackToIdle", true);
}
示例7: _AnimateComicBook
private IEnumerator _AnimateComicBook()
{
m_comicBookModel = GameObject.Find("ComicCharacter").GetComponent<Animator>();
m_comicBookModel.SetBool("IdleToIdle", false);
m_comicBookModel.SetBool("AttackToIdle", false);
m_comicBookModel.SetBool("IdleToAttack", true);
yield return new WaitForSeconds(0.3f);
Debug.Log("Animator clip info = " + m_comicBookModel.GetCurrentAnimatorClipInfo(0));
float animationLength = m_comicBookModel.GetCurrentAnimatorClipInfo(0)[0].clip.length;
yield return new WaitForSeconds(animationLength);
m_comicBookModel.SetBool("IdleToIdle", true);
m_comicBookModel.SetBool("IdleToAttack", false);
m_comicBookModel.SetBool("AttackToIdle", true);
}
示例8: Start
// Use this for initialization
void Start () {
animator = GetComponent<Animator>();
AnimatorClipInfo[] clipInfo = animator.GetCurrentAnimatorClipInfo(0);
//Debug.Log(clipInfo[0].clip.length);
Destroy(this.gameObject, clipInfo[0].clip.length);
}
示例9: Start
// Use this for initialization
void Start()
{
anim = GetComponent<Animator>();
timer = Time.time + anim.GetCurrentAnimatorClipInfo(0).Length;
}