// Update is called once per frame public void Update() { for (int i = 0; i < animList.Count; i++) { //执行Update animList[i].executeUpdate(); if (animList[i].m_isDone == true) { AnimData animTmp = animList[i]; //执行回调 animTmp.ExecuteCallBack(); if (!animTmp.AnimReplayLogic()) { removeList.Add(animTmp); } } } for (int i = 0; i < removeList.Count; i++) { animList.Remove(removeList[i]); } removeList.Clear(); }
/// <summary> /// 立即完成一个动画 /// </summary> /// <param name="animGameObject">要完成的</param> public static void FinishAnim(AnimData animData) { animData.m_currentTime = animData.m_totalTime; animData.executeUpdate(); animData.ExecuteCallBack(); GetInstance().animList.Remove(animData); }
/// <summary> /// 停止一个动画 /// </summary> /// <param name="animGameObject">要停止的动画</param> /// <param name="isCallBack">是否触发回调</param> public static void StopAnim(AnimData animData, bool isCallBack = false) { if (isCallBack) { animData.ExecuteCallBack(); } GetInstance().animList.Remove(animData); }
public static void ClearAllAnim(bool isCallBack = false) { for (int i = 0; i < GetInstance().animList.Count; i++) { AnimData animTmp = GetInstance().animList[i]; if (isCallBack) { animTmp.ExecuteCallBack(); } } GetInstance().animList.Clear(); }
/// <summary> /// 停止一个对象身上的所有动画 /// </summary> /// <param name="animGameObject">要停止动画的对象</param> /// <param name="isCallBack">是否触发回调</param> public static void StopAnim(GameObject animGameObject, bool isCallBack = false) { for (int i = 0; i < GetInstance().animList.Count; i++) { if (GetInstance().animList[i].m_animGameObejct == animGameObject) { AnimData animData = GetInstance().animList[i]; if (isCallBack) { animData.ExecuteCallBack(); } GetInstance().removeList.Add(animData); } } for (int i = 0; i < GetInstance().removeList.Count; i++) { GetInstance().animList.Remove(GetInstance().removeList[i]); } }