コード例 #1
0
    // 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);
    }
コード例 #2
0
    // 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);
    }