public void AddTrigger(TriggerCallback trigger) { if (!_callbacks.Contains(trigger)) { _callbacks.Add(trigger); } }
public SearchLightLogicInfo() { OnCreateNpc = null; IsCreated = false; PatrolPath = new List <Vector3>(); m_CurPathPointIndex = 0; m_IsReverse = false; m_Status = SearchLightStatus.kPatrol; m_NextTriggerTime = 0; }
void createExitCallBack() { //为我的检测盒子添加回调 GameObject body = GetBodyObject().transform.Find("Collider").gameObject; TriggerCallback DetectionCallback = body.GetComponent <TriggerCallback>(); if (DetectionCallback == null) { DetectionCallback = body.AddComponent <TriggerCallback>(); } DetectionCallback.EnterCallback = OnCheckEnterCallBack; DetectionCallback.ExitCallback = OnCheckExitCallBack; }
public override Deferred StartListening(CATContext context, TriggerCallback callback) { if (IsListening) { return(base.StartListening(context, callback)); } var dfrd = base.StartListening(context, callback); _brain = CinemachineCore.Instance.GetActiveBrain(0); _brain.m_CameraCutEvent.AddListener(OnCut); return(dfrd); }
void CreateEnterCallBack() { //攻击盒子添加回调 GameObject body = GetBodyObject(); TrapAttackActionCallback attackActionCallback = body.GetComponent <TrapAttackActionCallback>(); if (attackActionCallback == null) { body.AddComponent <TrapAttackActionCallback>(); } TriggerCallback enterCallBack = body.GetComponent <TriggerCallback>(); if (enterCallBack == null) { enterCallBack = body.AddComponent <TriggerCallback>(); } enterCallBack.EnterCallback = OnAttackEnterCallBack; enterCallBack.ExitCallback = OnAttackExitCallBack; }
public void BuildRoomData(int levelId) { // generate monster data m_parentObj = GameObject.Instantiate(CurRoomInfo.m_roomData) as GameObject; m_parentObj.transform.localPosition = Vector3.zero; m_parentObj.transform.position = CurRoomInfo.m_roomObj.transform.position; RoomDataCfg dataCfg = m_parentObj.GetComponent <RoomDataCfg>(); for (int i = 1; i <= dataCfg.MonsterCount; i++) { string str; if (i < 10) { str = string.Format("monster0{0}", i); } else { str = string.Format("monster{0}", i); } GameObject obj = m_parentObj.transform.Find(str).gameObject; RoomElement ele = obj.GetComponent <RoomElement>(); ele.MonsterData = new SM.MonsterRoomData(); ele.MonsterData.monsterId = i; ele.MonsterData.monsterObjId = ele.ObjSettingID; if (ele._PatrolList.Count <= 0) { ele._PatrolList = dataCfg._GlobalPatrolList; } ActorRefresh actor = new ActorRefresh(obj.transform, this); m_actorRefreshList.Add(actor); } //出生点 if (null == CurRoomInfo.m_parent) { Transform posTrans = m_parentObj.transform.Find("charPosition"); if (null == posTrans) { string objName = "charposition"; GameObject childObj = new GameObject(objName); childObj.transform.parent = m_parentObj.transform; childObj.transform.localPosition = new Vector3(CurRoomInfo.m_charPosition.x * blockWidth, 0f, CurRoomInfo.m_charPosition.z * blockHeight); CurRoomInfo.CharPosition = new Vector3(childObj.transform.position.x, 0.15f, childObj.transform.position.z);; CurRoomInfo.CharPosTransform = childObj.transform; } else { CurRoomInfo.CharPosition = new Vector3(posTrans.position.x, 0.15f, posTrans.position.z);; CurRoomInfo.CharPosTransform = posTrans; } } //激活检测开始战斗的刚体 if (CurRoomInfo.m_monsterDataList.Count > 0) { Transform starBattleColliderTans = CurRoomInfo.m_roomObj.transform.Find("activeArea"); if (starBattleColliderTans != null) { for (int i = 0; i < starBattleColliderTans.transform.childCount; i++) { Transform child = starBattleColliderTans.transform.GetChild(i); TriggerCallback triggerCallback = child.gameObject.AddComponent <TriggerCallback>(); triggerCallback.EnterCallback = OnCheckEnterCallBack; } } } }
public void RemoveTrigger(TriggerCallback trigger) { _callbacks.Remove(trigger); }
public void SetTriggerCallback(TriggerCallback callback) { triggerCallbackList.Add(callback); }
public void RemoveTrigger(E_TriggerType type, TriggerCallback callback) { m_triggerList[type].RemoveItem(callback); }
public void Invoke(TriggerCallback callback, Collider collider) { callback?.Invoke(collider); }
public void attach(TriggerCallback newCallbackEnter = null, TriggerCallback newCallbackExit = null) { callbackEnter = newCallbackEnter; callbackExit = newCallbackExit; }
public void SetTriggerCallback(TriggerCallback callback) { CheckErrorCode(CdioSdk.DioSetTrgCallBackProc(_id, new CdioSdk.TrgCallBack((short id, short message, long wParam, long lParam, IntPtr userData1) => { callback((short)wParam, (CdioTriggerTypeEnum)lParam); }), IntPtr.Zero)); }
public TriggerListener OnStay(TriggerCallback onStay) { this.onStay = onStay; return(this); }
public static extern void RegisterTriggerCallback(TriggerCallback callback);
public TriggerListener OnExit(TriggerCallback onExit) { this.onExit = onExit; return(this); }
public TriggerCallback AddTrigger(E_TriggerType type, TriggerCallback callback) { m_triggerList[type].Add(callback); return(callback); }
public TriggerListener OnEnter(TriggerCallback onEnter) { this.onEnter = onEnter; return(this); }
// trigger right public static void ListenTriggerRight(TriggerCallback cb) { instance.triggerRight_Listener += cb; }