// get action for frame from cache public AMAction getActionForFrame(int startFrame) { foreach (AMAction action in cache) { if (action.startFrame == startFrame) { return(action); } } Debug.LogError("Animator: No action found for frame " + startFrame); AMAction a = ScriptableObject.CreateInstance <AMAction>(); return(a); }
// get action for frame from cache public AMAction getActionContainingFrame(int frame) { for (int i = cache.Count - 1; i >= 0; i--) { if (frame >= cache[i].startFrame) { return(cache[i]); } } if (cache.Count > 0) { return(cache[0]); // return first if not greater than any action } Debug.LogError("Animator: No action found for frame " + frame); AMAction a = ScriptableObject.CreateInstance <AMAction>(); return(a); }