/// <summary> /// 过渡到状态 /// </summary> /// <param name="stateID">状态ID</param> /// <param name="startTime">新状态开始时间</param> /// <param name="transtionTime">过渡时间</param> /// <param name="transtionCurve">过渡曲线</param> public void TranstionState(EAPStateID stateID, float startTime, float transtionTime, AnimationCurve transtionCurve = null) { APStateBase state = GetState(stateID); int freeIdx = FindFreeMixerInputIndex(); // 过渡时间为0 则直接将权重设置为1 if (transtionTime <= Mathf.Epsilon) { for (int i = 0; i < m_inputStates.Count; i++) { m_inputStates[i].m_Weight = i == freeIdx ? 1 : 0; } m_transitionSpeed = 0; } else { m_inputStates[freeIdx].m_Weight = 0; m_transitionSpeed = 1 / transtionTime; } m_inputStates[freeIdx].m_StateID = stateID; m_crtPlayingInputIdx = freeIdx; Playable statePlayable = state.Output; state.SetTime(startTime); // 状态已经连接上 state.m_IsFree = false; StateMixer.ConnectInput(freeIdx, statePlayable, 0); StateMixer.SetInputWeight(freeIdx, 0); }
/// <summary> /// 获取状态 /// </summary> /// <param name="stateID"></param> /// <returns></returns> private APStateBase GetState(EAPStateID stateID) { return(m_states.Find(s => !s.m_IsDisposed && s.StateID == stateID)); }
public APClipState(EAPStateID stateID) : base(stateID) { }
public APStateBase(EAPStateID stateID) { StateID = stateID; }