当前位置: 首页>>代码示例>>C#>>正文


C# Animator.Update方法代码示例

本文整理汇总了C#中Animator.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Animator.Update方法的具体用法?C# Animator.Update怎么用?C# Animator.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Animator的用法示例。


在下文中一共展示了Animator.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Play

    public static bool Play(Animator anim, string name, float speed = 1.0f, float time = 0.0f)
    {
        if (!anim)
        {
            return false;
        }

        // Enable animator
        if (!anim.enabled)
        {
            anim.enabled = true;
        }

        anim.speed = speed;
        anim.Play(name, -1, time);
        anim.Update(0.0f); // Update for the latest state

        return true;
    }
开发者ID:Ankk4,项目名称:highlyresponsive-forever,代码行数:19,代码来源:AnimatorWrapper.cs

示例2: TestAnis

    void TestAnis()
    {
        ani = sellast.GetComponentInChildren<Animator>();
        Animation aniold = sellast.GetComponentInChildren<Animation>();
        SkinnedMeshRenderer[] skins = sellast.GetComponentsInChildren<SkinnedMeshRenderer>();

        GUILayout.Label("Find Ani:" + (ani != null) + ", skinmesh count=" + skins.Length);
        if (ani == null)
        {
            GUILayout.Label("Need Animator Component");
            if(aniold!=null)
            {
                GUILayout.Label("You have a old Animation Component.But we only support Animator.");

            }
            return;
        }
        List<AnimationClip> anis = new List<AnimationClip>();

        var ac = ani.runtimeAnimatorController as UnityEditorInternal.AnimatorController;
        FindAllAniInControl(ac, anis);

        foreach (var a in anis)
        {
            if (GUILayout.Button("haveani:" + a.name, GUILayout.MinWidth(1)))
            {
                _selectClip = a;
                anistart = 0;
                aniend = a.length;
                bPlay = false;
                //ani.Play(a.name, 0, 0);
            }
        }
        if(_selectClip)
        {
            var an = ani.GetCurrentAnimatorStateInfo(0);
            anistart = GUILayout.HorizontalSlider(anistart, 0, _selectClip.length, GUILayout.MinHeight(1));
            if (anistart >= aniend) anistart = aniend;
            aniend = GUILayout.HorizontalSlider(aniend, 0, _selectClip.length, GUILayout.MinHeight(1));
            if (aniend <= anistart) aniend = anistart;
            aninow = GUILayout.HorizontalSlider(aninow, anistart, aniend, GUILayout.MinHeight(1));
            if (!bPlay)
            {
                ani.Play(_selectClip.name, 0, 0);
                ani.speed = 1.0f;
                ani.Update(aninow);
            }
            bPlay = GUILayout.Toggle(bPlay, "Play", GUILayout.MaxWidth(100));
        }
    }
开发者ID:fordream,项目名称:fight,代码行数:50,代码来源:CleanAniEditor.cs

示例3: SyncAnimation

 private void SyncAnimation(Animator animator, float normalizedTime)
 {
     animator.Play(0, -1, normalizedTime);
     animator.Update(Time.deltaTime);
 }
开发者ID:MichaelHazani,项目名称:lighthouse-world,代码行数:5,代码来源:InstantGoodDay.cs


注:本文中的Animator.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。