Пример #1
0
    public void TriggerAnimEvent(int event_index)
    {
        string        anim_clip_name = anim.GetCurrentAnimatorClipInfo(0)[0].clip.name;
        ClipEventList list           = GetClipEventList(anim_clip_name);

        if (GetClipEventList(anim_clip_name) == null ||
            list.events.Count <= event_index)
        {
            return;
        }

        list.events[event_index].Invoke();
    }
Пример #2
0
    public bool RegisterAnimClipEvent(string anim_clip_name, int event_index, UnityAction action)
    {
        ClipEventList list = GetClipEventList(anim_clip_name);

        if (GetClipEventList(anim_clip_name) == null ||
            list.events.Count <= event_index)
        {
            return(false);
        }

        list.events[event_index].AddListener(action);
        return(true);
    }