Пример #1
0
    void AddTriggers(EventTrigger trigger, KeyControl kctrl)
    {
        //EventTrigger.Entry entry = new EventTrigger.Entry();
        //entry.eventID = EventTriggerType.PointerEnter;
        //entry.callback.AddListener((eventData) => { kctrl.OnKeyDown(); });
        //trigger.triggers.Add(entry);

        EventTrigger.Entry entry = new EventTrigger.Entry();
        entry.eventID = EventTriggerType.PointerDown;
        entry.callback.AddListener((eventData) => { kctrl.OnKeyDown(); });
        trigger.triggers.Add(entry);

        EventTrigger.Entry entry1 = new EventTrigger.Entry();
        entry1.eventID = EventTriggerType.PointerUp;
        entry1.callback.AddListener((eventData) => { kctrl.OnKeyUp(); });
        trigger.triggers.Add(entry1);
    }