public override void OnCreateConnection(NodePort from, NodePort to) { base.OnCreateConnection(from, to); if (from.node != this) { if (from != null && (from.node.GetType() == typeof(AI_Cond_PlayerTime) || from.node.GetType() == typeof(AI_Cond_PlayerAniTime))) { triggleType = CnsStateTriggerType.AnimTime; } else if ((from != null) && (from.node.GetType() == typeof(AI_Cond_PlayerAniElem)) || (from.node.GetType() == typeof(AI_Cond_PlayerAnimElemTime))) { triggleType = CnsStateTriggerType.AnimElem; } if (from.node is AI_CreateStateDef) { DoCreateConnect(from, to, ref parent, "parent"); } else if (from.node is AI_BaseCondition) { DoCreateConnect(from, to, ref condition, "condition"); } else { var p1 = GetPort("parent"); var p2 = GetPort("condition"); from.Disconnect(p1); from.Disconnect(p2); } } }
public CNSState CreateStateEvent(CnsStateTriggerType evtType, CnsStateType type) { if (evtType == CnsStateTriggerType.none) { return(null); } CNSState state = new CNSState(evtType, type); int key = (int)evtType; List <CNSState> list; if (m_StateEventsMap == null) { m_StateEventsMap = new Dictionary <int, List <CNSState> >(); list = null; } else { if (!m_StateEventsMap.TryGetValue(key, out list)) { list = null; } } if (list == null) { list = new List <CNSState>(); m_StateEventsMap[key] = list; } list.Add(state); return(state); }
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); } } } } }
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); }
public CNSState(CnsStateTriggerType triggeType, CnsStateType type) { m_TriggeType = triggeType; m_Type = type; m_GenId = ++m_GlobalId; }
public CNSState(CnsStateTriggerType triggeType, CnsStateType type) { m_TriggeType = triggeType; m_Type = type; }