コード例 #1
0
        private static ActionPoint RandomDestination(
            AgentActor agent,
            EventType eventType,
            List <ActionPoint> sourceList,
            List <ActionPoint> list,
            bool isFollow,
            bool isRain,
            out bool changeWarp)
        {
            changeWarp = false;
            if (eventType == EventType.Play && !isFollow)
            {
                List <ActionPoint> actionPointList = ListPool <ActionPoint> .Get();

                SetDesiredRandomAction.CreateList(agent, sourceList, actionPointList, EventType.Warp, false, isRain);
                if (list.IsNullOrEmpty <ActionPoint>() && actionPointList.IsNullOrEmpty <ActionPoint>())
                {
                    return((ActionPoint)null);
                }
                int index = Random.Range(0, list.Count + actionPointList.Count);
                ListPool <ActionPoint> .Release(actionPointList);

                changeWarp = index >= list.Count;
                return(!changeWarp?list.GetElement <ActionPoint>(index) : (ActionPoint)null);
            }
            return(list.IsNullOrEmpty <ActionPoint>() ? (ActionPoint)null : list.GetElement <ActionPoint>(Random.Range(0, list.Count)));
        }
コード例 #2
0
        public virtual void OnStart()
        {
            ((Task)this).OnStart();
            AgentActor agent = this.Agent;
            Chunk      chunk;

            Singleton <Manager.Map> .Instance.ChunkTable.TryGetValue(agent.ChunkID, out chunk);

            Vector3            position        = agent.Position;
            List <ActionPoint> actionPointList = ListPool <ActionPoint> .Get();

            this._changeWarp = false;
            switch (Singleton <Manager.Map> .Instance.Simulator.Weather)
            {
            case Weather.Rain:
            case Weather.Storm:
                if (!agent.ChaControl.fileGameInfo.normalSkill.ContainsValue(16))
                {
                    SetDesiredRandomAction.CreateList(agent, chunk.AppendActionPoints, actionPointList, this._eventType, this._checkFollowType, true);
                    this._destination = SetDesiredRandomAction.RandomDestination(agent, this._eventType, chunk.AppendActionPoints, actionPointList, this._checkFollowType, true, out this._changeWarp);
                    if (Object.op_Equality((Object)this._destination, (Object)null) && !this._changeWarp)
                    {
                        actionPointList.Clear();
                        SetDesiredRandomAction.CreateList(agent, chunk.ActionPoints, actionPointList, this._eventType, this._checkFollowType, true);
                        this._destination = SetDesiredRandomAction.RandomDestination(agent, this._eventType, chunk.ActionPoints, actionPointList, this._checkFollowType, true, out this._changeWarp);
                        break;
                    }
                    break;
                }
                break;
            }
            if (Object.op_Equality((Object)this._destination, (Object)null) && !this._changeWarp && !agent.ChaControl.fileGameInfo.normalSkill.ContainsValue(17))
            {
                actionPointList.Clear();
                SetDesiredRandomAction.CreateList(agent, chunk.AppendActionPoints, actionPointList, this._eventType, this._checkFollowType, false);
                this._destination = SetDesiredRandomAction.RandomDestination(agent, this._eventType, chunk.AppendActionPoints, actionPointList, this._checkFollowType, false, out this._changeWarp);
            }
            if (Object.op_Equality((Object)this._destination, (Object)null) && !this._changeWarp)
            {
                actionPointList.Clear();
                SetDesiredRandomAction.CreateList(agent, chunk.ActionPoints, actionPointList, this._eventType, this._checkFollowType, false);
                this._destination = SetDesiredRandomAction.RandomDestination(agent, this._eventType, chunk.ActionPoints, actionPointList, this._checkFollowType, false, out this._changeWarp);
            }
            ListPool <ActionPoint> .Release(actionPointList);
        }