/// <summary> /// 播放一个动画,默认过渡时间为0.3s,如果在此期间再次播放,则会继续播放 /// </summary> /// <param name="stateTypes"></param> /// <param name="fadeDuration">动画过渡时间</param> /// <returns></returns> public AnimancerState PlayAnim(StateTypes stateTypes, float fadeDuration = 0.3f, float speed = 1.0f) { return(PlayAnim(stateTypes.GetStateTypeMapedString(), fadeDuration, speed)); }
/// <summary> /// 播放一个动画,默认过渡时间为0.3s,如果在此期间再次播放,则会从头开始 /// </summary> /// <param name="stateTypes"></param> /// <param name="fadeDuration">动画过渡时间</param> /// <returns></returns> public AnimancerState PlayAnimFromStart(StateTypes stateTypes, float fadeDuration = 0.3f, float speed = 1.0f) { AnimancerState animancerState = AnimancerComponent.CrossFadeFromStart(this.AnimationClips[RuntimeAnimationClips[stateTypes.GetStateTypeMapedString()]], fadeDuration); animancerState.Speed = speed; return(animancerState); }