public virtual void OnStart() { ((Task)this).OnStart(); AgentActor agent = this.Agent; Vector3 position = agent.Position; List <ActionPoint> actionPointList = ListPool <ActionPoint> .Get(); PointManager pointAgent = Singleton <Manager.Map> .Instance.PointAgent; switch (Singleton <Manager.Map> .Instance.Simulator.Weather) { case Weather.Rain: case Weather.Storm: if (!agent.ChaControl.fileGameInfo.normalSkill.ContainsValue(16)) { SetDesiredActionOtherChunk.CreateList(agent, pointAgent.AppendActionPoints, actionPointList, this._eventType, this._checkFollowType, true); if (!actionPointList.IsNullOrEmpty <ActionPoint>()) { this._destination = actionPointList.GetElement <ActionPoint>(Random.Range(0, actionPointList.Count)); } if (Object.op_Equality((Object)this._destination, (Object)null)) { actionPointList.Clear(); SetDesiredActionOtherChunk.CreateList(agent, pointAgent.ActionPoints, actionPointList, this._eventType, this._checkFollowType, true); if (!actionPointList.IsNullOrEmpty <ActionPoint>()) { this._destination = actionPointList.GetElement <ActionPoint>(Random.Range(0, actionPointList.Count)); break; } break; } break; } break; } if (Object.op_Equality((Object)this._destination, (Object)null) && !agent.ChaControl.fileGameInfo.normalSkill.ContainsValue(17)) { actionPointList.Clear(); SetDesiredActionOtherChunk.CreateList(agent, pointAgent.AppendActionPoints, actionPointList, this._eventType, this._checkFollowType, false); if (!actionPointList.IsNullOrEmpty <ActionPoint>()) { this._destination = actionPointList.GetElement <ActionPoint>(Random.Range(0, actionPointList.Count)); } } if (Object.op_Equality((Object)this._destination, (Object)null)) { actionPointList.Clear(); SetDesiredActionOtherChunk.CreateList(agent, pointAgent.ActionPoints, actionPointList, this._eventType, this._checkFollowType, false); if (!actionPointList.IsNullOrEmpty <ActionPoint>()) { this._destination = actionPointList.GetElement <ActionPoint>(Random.Range(0, actionPointList.Count)); } } ListPool <ActionPoint> .Release(actionPointList); }
private static void CreateList( AgentActor agent, List <ActionPoint> source, List <ActionPoint> destination, EventType eventType, bool isFollow, bool isRain) { int chunkId = agent.ChunkID; Dictionary <int, bool> dictionary = DictionaryPool <int, bool> .Get(); int searchCount = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount; float meshSampleDistance = Singleton <Resources> .Instance.LocomotionProfile.ActionPointNavMeshSampleDistance; foreach (ActionPoint pt in source) { if (SetDesiredActionOtherChunk.CheckNeutral(agent, pt, dictionary, searchCount, chunkId, eventType, isFollow, isRain, meshSampleDistance)) { destination.Add(pt); } } DictionaryPool <int, bool> .Release(dictionary); }