动画系统修复一些BUG,增加全局的速度控制,配置文件少量新增与优化

alt

补一句少个false。

给所有动画Clip速度添加全局控制,不只是在播放时临时调整速度。

    private float speed;

    public float Speed
    {
        get => speed;
        set
        {
            speed = value;
            if (currentisBlend)
            {
                for (int i = 0; i < blendClipPlayableList.Count; i++)
                {
                    blendClipPlayableList[0].SetSpeed(value);
                }
            }
            else if(currentisClipPlayable1)
            {
                clipPlayable1.SetSpeed(value);
            }
            else
            {
                clipPlayable2.SetSpeed(value);
            }
        }
    }

给AnimatorController添加一个全局控制。

public class WarriorConfig : ConfigBase
{
    [LabelText("走路速度")]public float WalkSpeed;
    [LabelText("奔跑速度")] public float RunSpeed;
    [LabelText("走路到奔跑过渡速度")]public float Walk2RunTransitionSpeed;
    [LabelText("旋转速度")] public float RotateSpeed;
    [LabelText("为移动应用RootMotion")] public bool ApplyRootMotionForMove;
    [LabelText("标准动画表")]public Dictionary<string, AnimationClip> StandAnimationDic;
    public AnimationClip GetAnimationByName(string animationName)
    {
        return StandAnimationDic[animationName];
    }
}

给配置文件添加一些说明。

alt

alt

原来我们在Player_Controller里面定义了若干属性供外界访问配置中的速度等量,速度相关在后续可以通过Set来做一些计算,但走跑过渡速度没有必要给属性,所以这里删除,定义一个Warrior属性供外界只读访问数值。

alt

alt

最后把WarriorConfig拓展成通用的CharacterConfig,重命名即可。