public List <PoolObjHandle <ActorRoot> > GetActorsInPolygon(GeoPolygon collisionPolygon, AreaEventTrigger InTriggerRef) { if (collisionPolygon == null) { return(null); } List <PoolObjHandle <ActorRoot> > list = null; List <PoolObjHandle <ActorRoot> > gameActors = Singleton <GameObjMgr> .GetInstance().GameActors; int count = gameActors.Count; for (int i = 0; i < count; i++) { PoolObjHandle <ActorRoot> act = gameActors[i]; if (((act != 0) && ((null == InTriggerRef) || InTriggerRef.ActorFilter(ref act))) && collisionPolygon.IsPointIn(act.handle.location)) { if (list == null) { list = new List <PoolObjHandle <ActorRoot> >(); } list.Add(act); } } return(list); }
public override void Startup() { base.Startup(); this._thisActor = ActorHelper.GetActorRoot(this.sourceActor); this.m_collidePolygon = base.gameObject.GetComponent <GeoPolygon>(); if (!this.CoolMode || !this._coolingDown) { this.OnTriggerStart(); } }
public override void Startup() { base.Startup(); this._thisActor = ActorHelper.GetActorRoot(this.sourceActor); this.m_collidePolygon = base.gameObject.GetComponent<GeoPolygon>(); Singleton<GameEventSys>.instance.RmvEventHandler<DefaultGameEventParam>(GameEventDef.Event_ActorDestroy, new RefAction<DefaultGameEventParam>(this.onActorDestroy)); Singleton<GameEventSys>.instance.AddEventHandler<DefaultGameEventParam>(GameEventDef.Event_ActorDestroy, new RefAction<DefaultGameEventParam>(this.onActorDestroy)); if (!this.CoolMode || !this._coolingDown) { this.OnTriggerStart(); } }
public static void DoSpawn(GameObject inGameObj, VInt3 bornPos, VInt3 bornDir, bool bInSeqMeta, ActorMeta[] inActorMetaList, GeoPolygon inPolygon, GameObject inDeadPoint, PursuitInfo pursuitInfo, int[] inBuffDemand, int inRandPassSkillRule, ref List <PoolObjHandle <ActorRoot> > inSpawnedList) { if (inGameObj == null || inActorMetaList == null || inActorMetaList.Length == 0 || inSpawnedList == null) { return; } List <ActorMeta> list = new List <ActorMeta>(); if (bInSeqMeta) { list.AddRange(inActorMetaList); } else if (inActorMetaList.Length > 0) { int nMax = inActorMetaList.Length; int num = (int)FrameRandom.Random((uint)nMax); list.Add(inActorMetaList[num]); } List <ActorMeta> .Enumerator enumerator = list.GetEnumerator(); while (enumerator.MoveNext()) { ActorMeta current = enumerator.get_Current(); if (current.ConfigId > 0 && current.ActorType != ActorTypeDef.Invalid) { PoolObjHandle <ActorRoot> poolObjHandle = default(PoolObjHandle <ActorRoot>); if (!Singleton <GameObjMgr> .GetInstance().TryGetFromCache(ref poolObjHandle, ref current)) { poolObjHandle = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref current, bornPos, bornDir, false, true); if (poolObjHandle) { poolObjHandle.get_handle().InitActor(); poolObjHandle.get_handle().PrepareFight(); Singleton <GameObjMgr> .get_instance().AddActor(poolObjHandle); poolObjHandle.get_handle().StartFight(); } } else { poolObjHandle.get_handle().ReactiveActor(bornPos, bornDir); } if (poolObjHandle) { poolObjHandle.get_handle().ObjLinker.Invincible = current.Invincible; poolObjHandle.get_handle().ObjLinker.CanMovable = !current.NotMovable; poolObjHandle.get_handle().BornPos = bornPos; if (inPolygon != null && inDeadPoint != null) { poolObjHandle.get_handle().ActorControl.m_rangePolygon = inPolygon; poolObjHandle.get_handle().ActorControl.m_deadPointGo = inDeadPoint; } if (pursuitInfo != null && pursuitInfo.IsVaild()) { MonsterWrapper monsterWrapper = poolObjHandle.get_handle().ActorControl as MonsterWrapper; if (monsterWrapper != null) { monsterWrapper.Pursuit = pursuitInfo; } } inSpawnedList.Add(poolObjHandle); if (inBuffDemand != null) { for (int i = 0; i < inBuffDemand.Length; i++) { int inBuffID = inBuffDemand[i]; BufConsumer bufConsumer = new BufConsumer(inBuffID, poolObjHandle, poolObjHandle); bufConsumer.Use(); } } if (inRandPassSkillRule > 0 && poolObjHandle.get_handle().SkillControl != null) { poolObjHandle.get_handle().SkillControl.InitRandomSkill(inRandPassSkillRule); } } } } }
public static void DoSpawn(GameObject inGameObj, VInt3 bornPos, VInt3 bornDir, bool bInSeqMeta, ActorMeta[] inActorMetaList, GeoPolygon inPolygon, GameObject inDeadPoint, int[] inBuffDemand, int inRandPassSkillRule, ref List <PoolObjHandle <ActorRoot> > inSpawnedList) { if (((inGameObj != null) && (inActorMetaList != null)) && ((inActorMetaList.Length != 0) && (inSpawnedList != null))) { List <ActorMeta> list = new List <ActorMeta>(); if (bInSeqMeta) { list.AddRange(inActorMetaList); } else if (inActorMetaList.Length > 0) { int length = inActorMetaList.Length; int index = FrameRandom.Random((uint)length); list.Add(inActorMetaList[index]); } List <ActorMeta> .Enumerator enumerator = list.GetEnumerator(); while (enumerator.MoveNext()) { ActorMeta current = enumerator.Current; if ((current.ConfigId > 0) && (current.ActorType != ActorTypeDef.Invalid)) { PoolObjHandle <ActorRoot> actor = new PoolObjHandle <ActorRoot>(); if (!Singleton <GameObjMgr> .GetInstance().TryGetFromCache(ref actor, ref current)) { actor = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref current, bornPos, bornDir, false, true); if (actor != 0) { actor.handle.InitActor(); actor.handle.PrepareFight(); Singleton <GameObjMgr> .instance.AddActor(actor); actor.handle.StartFight(); } } else { actor.handle.ReactiveActor(bornPos, bornDir); } if (actor != 0) { actor.handle.ObjLinker.Invincible = current.Invincible; actor.handle.ObjLinker.CanMovable = !current.NotMovable; if ((inPolygon != null) && (inDeadPoint != null)) { actor.handle.ActorControl.m_rangePolygon = inPolygon; actor.handle.ActorControl.m_deadPointGo = inDeadPoint; } inSpawnedList.Add(actor); if (inBuffDemand != null) { foreach (int num3 in inBuffDemand) { new BufConsumer(num3, actor, actor).Use(); } } if ((inRandPassSkillRule > 0) && (actor.handle.SkillControl != null)) { actor.handle.SkillControl.InitRandomSkill(inRandPassSkillRule); } } } } } }