Beispiel #1
0
        public void AddInputEventListener(int nPlayerID, int nButtonID
                                          , GetInputType eInput, UnityAction hAction, EventOrder eOrder = EventOrder.Normal)
        {
            if (!HasPlayerID(nPlayerID))
            {
                return;
            }

            var hInputData = m_lstPlayerInput[nPlayerID];

            if (hInputData.m_dicButton.TryGetValue(nButtonID, out ButtonData hButtonData))
            {
                hButtonData.m_hInputEvent ??= new EventCallback <GetInputType>();
                hButtonData.m_hInputEvent.Add(eInput, hAction, eOrder);
            }
            else
            {
                var hNewEvent = new EventCallback <GetInputType>();
                hNewEvent.Add(eInput, hAction, eOrder);
                hInputData.m_dicButton.Add(nButtonID, new ButtonData
                {
                    m_eGetType    = GetInputType.None,
                    m_hInputEvent = hNewEvent
                });
            }
        }
 void MainAddOnTakeDamageListener(UnityAction <DamageData> hAction, EventOrder eOrder = EventOrder.Normal)
 {
     m_hDamageableEvent.Add(DamageableEvent.TakeDamage, hAction, eOrder);
 }