Exemplo n.º 1
0
        public void OnStateEvent(PlayerDisplay display, CnsStateTriggerType evtType)
        {
            if (display == null)
            {
                return;
            }

            // 触发状态事件
            if (m_StateEventsMap != null)
            {
                int             key = (int)evtType;
                List <CNSState> list;
                if (m_StateEventsMap.TryGetValue(key, out list))
                {
                    for (int i = 0; i < list.Count; ++i)
                    {
                        CNSState state = list [i];
                        if (state != null)
                        {
                            state.Call_TriggerEvent(display);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public bool OnStateEvent(PlayerDisplay display, CnsStateTriggerType evtType, System.Object userData = null)
        {
            if (display == null)
            {
                return(false);
            }

            if (evtType == CnsStateTriggerType.Hited)
            {
                if (m_NotHit != null)
                {
                    if (m_NotHit.CheckPlayer(display, userData as PlayerDisplay))
                    {
                        return(false);
                    }
                }
                return(true);
            }

            if (evtType == CnsStateTriggerType.AnimTime)
            {
                UpdateNotHit(display);
            }

            // 触发状态事件
            if (m_StateEventsMap != null)
            {
                int             key = (int)evtType;
                List <CNSState> list;
                if (m_StateEventsMap.TryGetValue(key, out list))
                {
                    for (int i = 0; i < list.Count; ++i)
                    {
                        CNSState state = list [i];
                        if (state != null && (!display.IsStatePersistent(state)))
                        {
                            state.Call_TriggerEvent(display);
                        }
                    }
                }
            }

            return(true);
        }