public virtual void OnBehaviorComplete()
 {
     if (Object.op_Equality((Object)this._bookingPoint, (Object)null))
     {
         return;
     }
     this._bookingPoint.RemoveBooking((Actor)this._agent);
     if (Object.op_Equality((Object)this.Agent.BookingActionPoint, (Object)this._bookingPoint))
     {
         this.Agent.BookingActionPoint = (ActionPoint)null;
     }
     this._bookingPoint = (ActionPoint)null;
 }
        public virtual void OnStart()
        {
            ((Task)this).OnStart();
            AgentActor agent = this.Agent;

            agent.ActivateTransfer(true);
            ActionPoint sightActionPoint = agent.TargetInSightActionPoint;

            if (!Object.op_Inequality((Object)sightActionPoint, (Object)null))
            {
                return;
            }
            Vector3?nullable = new Vector3?(sightActionPoint.LocatedPosition);

            agent.DestPosition = nullable;
            this.SetDestinationForce(nullable.Value);
        }
        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);
        }
        public override void OnStart()
        {
            this.Agent.EventKey = EventType.Move;
            OffMeshLinkData currentOffMeshLinkData = this.Agent.NavMeshAgent.get_currentOffMeshLinkData();
            ActionPoint     component = (ActionPoint)((Component)((OffMeshLinkData) ref currentOffMeshLinkData).get_offMeshLink()).GetComponent <ActionPoint>();

            this.Agent.TargetInSightActionPoint = component;
            this._actionMotion = new PoseKeyPair()
            {
                postureID = -1,
                poseID    = -1
            };
            if (Singleton <Resources> .IsInstance() && Object.op_Inequality((Object)component, (Object)null))
            {
                AgentProfile.TutorialSetting tutorial = Singleton <Resources> .Instance.AgentProfile.Tutorial;
                if (0 <= component.ID)
                {
                    int id = component.ID;
                    if (((IEnumerable <int>)tutorial.GoGhroughActionIDList).Contains <int>(id))
                    {
                        this._actionMotion = tutorial.GoGhroughAnimID;
                    }
                    else if (((IEnumerable <int>)tutorial.ThreeStepJumpActionIDList).Contains <int>(id))
                    {
                        this._actionMotion = tutorial.ThreeStepJumpAnimID;
                    }
                }
                else if (!component.IDList.IsNullOrEmpty <int>())
                {
                    foreach (int id in component.IDList)
                    {
                        if (((IEnumerable <int>)tutorial.GoGhroughActionIDList).Contains <int>(id))
                        {
                            this._actionMotion = tutorial.GoGhroughAnimID;
                        }
                        else if (((IEnumerable <int>)tutorial.ThreeStepJumpActionIDList).Contains <int>(id))
                        {
                            this._actionMotion = tutorial.ThreeStepJumpAnimID;
                        }
                    }
                }
            }
            base.OnStart();
        }
        public virtual TaskStatus OnUpdate()
        {
            AgentActor  agent            = this.Agent;
            ActionPoint sightActionPoint = agent.TargetInSightActionPoint;

            agent.CurrentPoint = sightActionPoint;
            ActionPoint actionPoint = sightActionPoint;

            actionPoint.SetSlot((Actor)agent);
            PoseKeyPair     sleepTogetherRight = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.SleepTogetherRight;
            PoseKeyPair     sleepTogetherLeft  = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.SleepTogetherLeft;
            bool            flag    = false;
            ActionPointInfo outInfo = new ActionPointInfo();

            if (Object.op_Inequality((Object)actionPoint, (Object)null))
            {
                flag = actionPoint.FindAgentActionPointInfo(EventType.Sleep, sleepTogetherRight.poseID, out outInfo) || actionPoint.FindAgentActionPointInfo(EventType.Sleep, sleepTogetherLeft.poseID, out outInfo);
            }
            if (!flag)
            {
                agent.ChangeBehavior(Desire.ActionType.Normal);
                return((TaskStatus)1);
            }
            Transform  t    = ((Component)actionPoint).get_transform().FindLoop(outInfo.baseNullName)?.get_transform() ?? ((Component)actionPoint).get_transform();
            GameObject loop = ((Component)actionPoint).get_transform().FindLoop(outInfo.recoveryNullName);

            agent.Animation.RecoveryPoint = loop?.get_transform();
            PlayState     info          = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[outInfo.eventID][outInfo.poseID];
            ActorAnimInfo actorAnimInfo = agent.Animation.LoadActionState(outInfo.eventID, outInfo.poseID, info);

            agent.SetActiveOnEquipedItem(false);
            agent.ChaControl.setAllLayerWeight(0.0f);
            agent.DisableActionFlag();
            agent.DeactivateNavMeshAgent();
            agent.IsKinematic = true;
            agent.Animation.PlayInAnimation(actorAnimInfo.inEnableBlend, actorAnimInfo.inBlendSec, info.MainStateInfo.FadeOutTime, actorAnimInfo.layer);
            agent.SetStand(t, info.MainStateInfo.InStateInfo.EnableFade, info.MainStateInfo.InStateInfo.FadeSecond, info.DirectionType);
            agent.SetCurrentSchedule(actorAnimInfo.isLoop, "添い寝", actorAnimInfo.loopMinTime, actorAnimInfo.loopMaxTime, actorAnimInfo.hasAction, true);
            agent.ChangeBehavior(Desire.ActionType.EndTaskSleepAfterDate);
            return((TaskStatus)2);
        }
        public virtual TaskStatus OnUpdate()
        {
            int        hizamakuraID = Singleton <Resources> .Instance.PlayerProfile.HizamakuraPTID;
            AgentActor agent        = this.Agent;

            if (Object.op_Inequality((Object)agent.TargetInSightActionPoint, (Object)null))
            {
                ActionPoint sightActionPoint = agent.TargetInSightActionPoint;
                if (!sightActionPoint.IDList.IsNullOrEmpty <int>() && ((IEnumerable <int>)sightActionPoint.IDList).Any <int>((Func <int, bool>)(x => x == hizamakuraID)) || sightActionPoint.IDList.IsNullOrEmpty <int>() && sightActionPoint.ID == hizamakuraID)
                {
                    return((TaskStatus)2);
                }
            }
            if (Object.op_Equality((Object)this._destination, (Object)null))
            {
                return((TaskStatus)1);
            }
            agent.TargetInSightActionPoint = this._destination;
            agent.EventKey             = EventType.Break;
            this._destination.Reserver = (Actor)agent;
            return((TaskStatus)2);
        }
        public virtual TaskStatus OnUpdate()
        {
            NavMeshAgent navMeshAgent = this._agent.NavMeshAgent;
            M0           m0;

            if (navMeshAgent == null)
            {
                m0 = (M0)null;
            }
            else
            {
                OffMeshLinkData currentOffMeshLinkData = navMeshAgent.get_currentOffMeshLinkData();
                m0 = ((Component)((OffMeshLinkData) ref currentOffMeshLinkData).get_offMeshLink())?.GetComponent <ActionPoint>();
            }
            this._bookingPoint = (ActionPoint)m0;
            if (Object.op_Equality((Object)this._bookingPoint, (Object)null))
            {
                return((TaskStatus)1);
            }
            this._bookingPoint.AddBooking((Actor)this._agent);
            this._agent.BookingActionPoint = this._bookingPoint;
            return((TaskStatus)2);
        }
        public override void OnStart()
        {
            this._unchangeParamState = true;
            AgentActor agent = this.Agent;

            this._prevEventKey = agent.EventKey;
            agent.EventKey     = EventType.DoorOpen;
            OffMeshLinkData currentOffMeshLinkData = agent.NavMeshAgent.get_currentOffMeshLinkData();
            DoorPoint       component1             = (DoorPoint)((Component)((OffMeshLinkData) ref currentOffMeshLinkData).get_offMeshLink()).GetComponent <DoorPoint>();

            this._prevTargetPoint = agent.TargetInSightActionPoint;
            this._isDoorOpen      = !((OffMeshLinkData) ref currentOffMeshLinkData).get_activated() || Object.op_Equality((Object)component1, (Object)null) || component1.IsOpen;
            if (this._isDoorOpen)
            {
                agent.EventKey = this._prevEventKey;
            }
            else
            {
                agent.TargetInSightActionPoint = (ActionPoint)component1;
                base.OnStart();
                if (!Object.op_Inequality((Object)agent.CurrentPoint, (Object)null))
                {
                    return;
                }
                DoorAnimation component2 = (DoorAnimation)((Component)agent.CurrentPoint).GetComponent <DoorAnimation>();
                if (!Object.op_Inequality((Object)component2, (Object)null))
                {
                    return;
                }
                ActionPointInfo actionPointInfo = agent.Animation.ActionPointInfo;
                PlayState       playState       = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[actionPointInfo.eventID][actionPointInfo.poseID];
                component2.Load(playState.MainStateInfo.InStateInfo.StateInfos);
                ActorAnimInfo animInfo = agent.Animation.AnimInfo;
                component2.PlayAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, playState.MainStateInfo.FadeOutTime, animInfo.layer);
            }
        }
        private static void NearestPoint(
            Vector3 position,
            List <ActionPoint> actionPoints,
            out ActionPoint destination)
        {
            destination = (ActionPoint)null;
            float?  nullable = new float?();
            Vector3 vector3  = position;

            foreach (ActionPoint actionPoint in actionPoints)
            {
                float num = Vector3.Distance(vector3, actionPoint.Position);
                if (!nullable.HasValue)
                {
                    nullable    = new float?(num);
                    destination = actionPoint;
                }
                else if (!nullable.HasValue || (!nullable.HasValue ? 0 : ((double)nullable.GetValueOrDefault() <= (double)num ? 1 : 0)) == 0)
                {
                    nullable    = new float?(num);
                    destination = actionPoint;
                }
            }
        }
Exemple #10
0
        protected override void OnCompletedStateTask()
        {
            AgentActor agent     = this.Agent;
            int        desireKey = Desire.GetDesireKey(Desire.Type.Hunt);

            agent.SetDesire(desireKey, 0.0f);
            Dictionary <int, AIProject.SaveData.Environment.SearchActionInfo> searchActionLockTable = agent.AgentData.SearchActionLockTable;

            AIProject.SaveData.Environment.SearchActionInfo searchActionInfo;
            if (!searchActionLockTable.TryGetValue(agent.CurrentPoint.RegisterID, out searchActionInfo))
            {
                searchActionInfo = new AIProject.SaveData.Environment.SearchActionInfo();
            }
            ++searchActionInfo.Count;
            searchActionLockTable[agent.CurrentPoint.RegisterID] = searchActionInfo;
            ActionPoint currentPoint = this.Agent.CurrentPoint;
            Dictionary <int, ItemTableElement> itemTableInArea = Singleton <Resources> .Instance.GameInfo.GetItemTableInArea(currentPoint.IDList.IsNullOrEmpty <int>()?currentPoint.ID : currentPoint.IDList.GetElement <int>(0));

            if (itemTableInArea != null)
            {
                ;
            }
            Actor.SearchInfo searchInfo = agent.RandomAddItem(itemTableInArea, false);
            if (!searchInfo.IsSuccess)
            {
                return;
            }
            foreach (Actor.ItemSearchInfo itemSearchInfo in searchInfo.ItemList)
            {
                StuffItem stuffItem = new StuffItem(itemSearchInfo.categoryID, itemSearchInfo.id, itemSearchInfo.count);
                agent.AgentData.ItemList.AddItem(stuffItem);
                StuffItemInfo info = Singleton <Resources> .Instance.GameInfo.GetItem(itemSearchInfo.categoryID, itemSearchInfo.id);

                MapUIContainer.AddItemLog((Actor)agent, info, itemSearchInfo.count, false);
            }
        }
 public virtual void OnEnd()
 {
     ((Task)this).OnEnd();
     this._destination = (ActionPoint)null;
 }
 public bool RemovePoint(ActionPoint ap)
 {
     return(!Object.op_Equality((Object)ap, (Object)null) && this._searchPoints.Remove(ap));
 }
        public AgentController.PermissionStatus GetPermission(ActionPoint point)
        {
            AgentActor actor = this._actor as AgentActor;

            ValueTuple <EventType, Desire.Type>[] valuePairs = Desire.ValuePairs;
            Desire.Type requestedDesire = actor.RequestedDesire;
            if (!point.IsNeutralCommand)
            {
                Debug.Log((object)"行動ポイントが満員御礼");
                AgentController.PermissionStatus permissionStatus1 = AgentController.PermissionStatus.Prohibition;
                this.Permission = permissionStatus1;
                AgentController.PermissionStatus permissionStatus2;
                return(permissionStatus2 = permissionStatus1);
            }
            AgentController.PermissionStatus permissionStatus3;
            if (AgentController.AnyDesire(valuePairs, requestedDesire))
            {
                EventType type = (EventType)AgentController.FirstDesire(valuePairs, requestedDesire).Item1;
                if (requestedDesire == Desire.Type.Bath && (double)actor.ChaControl.fileGameInfo.flavorState[2] < (double)Singleton <Resources> .Instance.StatusProfile.CanDressBorder)
                {
                    type = EventType.Bath;
                }
                if (point.AgentEventType.Contains(type))
                {
                    if (point is SearchActionPoint)
                    {
                        SearchActionPoint searchActionPoint = point as SearchActionPoint;
                        StuffItem         itemInfo          = actor.AgentData.EquipedSearchItem(searchActionPoint.TableID);
                        if (actor.SearchAreaID == 0)
                        {
                            if (searchActionPoint.TableID == 0 || searchActionPoint.TableID == 1 || searchActionPoint.TableID == 2)
                            {
                                if (searchActionPoint.CanSearch(EventType.Search, itemInfo))
                                {
                                    AgentController.PermissionStatus permissionStatus1 = AgentController.PermissionStatus.Permission;
                                    this.Permission   = permissionStatus1;
                                    permissionStatus3 = permissionStatus1;
                                }
                                else
                                {
                                    AgentController.PermissionStatus permissionStatus1 = AgentController.PermissionStatus.Prohibition;
                                    this.Permission   = permissionStatus1;
                                    permissionStatus3 = permissionStatus1;
                                }
                            }
                            else
                            {
                                AgentController.PermissionStatus permissionStatus1 = AgentController.PermissionStatus.Prohibition;
                                this.Permission   = permissionStatus1;
                                permissionStatus3 = permissionStatus1;
                            }
                        }
                        else if (actor.SearchAreaID == searchActionPoint.TableID)
                        {
                            if (searchActionPoint.CanSearch(EventType.Search, itemInfo))
                            {
                                AgentController.PermissionStatus permissionStatus1 = AgentController.PermissionStatus.Permission;
                                this.Permission   = permissionStatus1;
                                permissionStatus3 = permissionStatus1;
                            }
                            else
                            {
                                AgentController.PermissionStatus permissionStatus1 = AgentController.PermissionStatus.Prohibition;
                                this.Permission   = permissionStatus1;
                                permissionStatus3 = permissionStatus1;
                            }
                        }
                        else
                        {
                            AgentController.PermissionStatus permissionStatus1 = AgentController.PermissionStatus.Prohibition;
                            this.Permission   = permissionStatus1;
                            permissionStatus3 = permissionStatus1;
                        }
                    }
                    else
                    {
                        AgentController.PermissionStatus permissionStatus1 = AgentController.PermissionStatus.Permission;
                        this.Permission   = permissionStatus1;
                        permissionStatus3 = permissionStatus1;
                    }
                }
                else
                {
                    AgentController.PermissionStatus permissionStatus1 = AgentController.PermissionStatus.Prohibition;
                    this.Permission   = permissionStatus1;
                    permissionStatus3 = permissionStatus1;
                }
            }
            else
            {
                AgentController.PermissionStatus permissionStatus1 = AgentController.PermissionStatus.Prohibition;
                this.Permission   = permissionStatus1;
                permissionStatus3 = permissionStatus1;
            }
            return(permissionStatus3);
        }
 protected void Start()
 {
     this._actionPoint = (ActionPoint)((Component)this).GetComponent <ActionPoint>();
     this.OnStart();
 }
        public virtual TaskStatus OnUpdate()
        {
            AgentActor agent = this.Agent;
            Dictionary <int, CollisionState> collisionStateTable = agent.ActionPointCollisionStateTable;
            List <ActionPoint> toRelease = ListPool <ActionPoint> .Get();

            foreach (ActionPoint searchTarget in agent.SearchTargets)
            {
                CollisionState collisionState;
                if (collisionStateTable.TryGetValue(searchTarget.InstanceID, out collisionState) && collisionState == CollisionState.Enter)
                {
                    toRelease.Add(searchTarget);
                }
            }
            if (toRelease.Count > 0)
            {
                List <ActionPoint> actionPointList = ListPool <ActionPoint> .Get();

                foreach (ActionPoint actionPoint in toRelease)
                {
                    if (actionPoint.IsNeutralCommand)
                    {
                        actionPointList.Add(actionPoint);
                    }
                }
                Desire.Type requestedDesire = agent.RequestedDesire;
                EventType   type            = (EventType)0;
                foreach (ValueTuple <EventType, Desire.Type> valuePair in Desire.ValuePairs)
                {
                    if ((Desire.Type)valuePair.Item2 == requestedDesire)
                    {
                        type = (EventType)valuePair.Item1;
                        break;
                    }
                }
                ActionPoint point = (ActionPoint)null;
                foreach (ActionPoint actionPoint in actionPointList)
                {
                    if (Object.op_Inequality((Object)agent.Partner, (Object)null))
                    {
                        if (actionPoint.AgentDateEventType.Contains(type))
                        {
                            point = actionPoint;
                        }
                    }
                    else if (actionPoint.AgentEventType.Contains(type))
                    {
                        point = actionPoint;
                    }
                }
                if (Object.op_Equality((Object)point, (Object)null))
                {
                    point = actionPointList.GetElement <ActionPoint>(Random.Range(0, actionPointList.Count));
                    if (Object.op_Equality((Object)point, (Object)null))
                    {
                        ListPool <ActionPoint> .Release(actionPointList);

                        ListPool <ActionPoint> .Release(toRelease);

                        return((TaskStatus)1);
                    }
                }
                ListPool <ActionPoint> .Release(actionPointList);

                if (Debug.get_isDebugBuild())
                {
                    if (Object.op_Inequality((Object)agent.Partner, (Object)null))
                    {
                        Debug.Log((object)string.Format("{0} :: Enter Point In Sight: {1} <{2}>", (object)((Object)((Component)agent).get_gameObject()).get_name(), (object)((Object)point).get_name(), (object)point.AgentDateEventType));
                    }
                    else
                    {
                        Debug.Log((object)string.Format("{0} :: Enter Point In Sight: {1} <{2}>", (object)((Object)((Component)agent).get_gameObject()).get_name(), (object)((Object)point).get_name(), (object)point.AgentEventType));
                    }
                }
                if (requestedDesire == Desire.Type.Bath && type == EventType.DressIn && (double)agent.ChaControl.fileGameInfo.flavorState[2] < (double)Singleton <Resources> .Instance.StatusProfile.CanDressBorder)
                {
                    type = EventType.Bath;
                }
                if (type == EventType.Eat)
                {
                    StuffItem       carryingItem     = agent.AgentData.CarryingItem;
                    AgentProfile    agentProfile     = Singleton <Resources> .Instance.AgentProfile;
                    ItemIDKeyPair[] canStandEatItems = Singleton <Resources> .Instance.AgentProfile.CanStandEatItems;
                    bool            flag             = false;
                    foreach (ItemIDKeyPair itemIdKeyPair in canStandEatItems)
                    {
                        if (carryingItem.CategoryID == itemIdKeyPair.categoryID && carryingItem.ID == itemIdKeyPair.itemID)
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (flag)
                    {
                        PoseKeyPair     eatDeskId  = agentProfile.PoseIDTable.EatDeskID;
                        PoseKeyPair     eatChairId = agentProfile.PoseIDTable.EatChairID;
                        ActionPointInfo outInfo;
                        if (!point.FindAgentActionPointInfo(EventType.Eat, eatDeskId.poseID, out outInfo) && !point.FindAgentActionPointInfo(EventType.Eat, eatChairId.poseID, out outInfo))
                        {
                            return((TaskStatus)1);
                        }
                    }
                    else
                    {
                        PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID;
                        if (!point.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out ActionPointInfo _))
                        {
                            return((TaskStatus)1);
                        }
                    }
                }
                switch (agent.AgentController.GetPermission(point))
                {
                case AgentController.PermissionStatus.Prohibition:
                    Debug.Log((object)string.Format("目的地落選: {0}", (object)((Object)point).get_name()));
                    break;

                case AgentController.PermissionStatus.Permission:
                    Debug.Log((object)string.Format("目的地当選: {0}", (object)((Object)point).get_name()));
                    if (type == (EventType)0)
                    {
                        Debug.LogError((object)string.Format("EventType該当なし: {0}", (object)requestedDesire));
                    }
                    agent.EventKey = type;
                    agent.TargetInSightActionPoint = point;
                    agent.RuntimeDesire            = agent.RequestedDesire;
                    break;
                }
            }
            ListPool <ActionPoint> .Release(toRelease);

            if (!Object.op_Inequality((Object)agent.TargetInSightActionPoint, (Object)null))
            {
                return((TaskStatus)1);
            }
            agent.ClearReservedNearActionWaypoints();
            agent.AbortActionPatrol();
            return((TaskStatus)2);
        }
Exemple #16
0
        private static bool CheckNeutral(
            AgentActor agent,
            ActionPoint pt,
            Dictionary <int, bool> availableArea,
            int searchCount,
            int chunkID,
            EventType eventType,
            bool isFollow,
            bool isRain,
            float sampleDistance)
        {
            if (Object.op_Equality((Object)pt, (Object)null) || Object.op_Equality((Object)pt.OwnerArea, (Object)null) || (!pt.IsNeutralCommand || pt.IsReserved(agent)))
            {
                return(false);
            }
            List <ActionPoint> connectedActionPoints = pt.ConnectedActionPoints;

            if (!connectedActionPoints.IsNullOrEmpty <ActionPoint>())
            {
                foreach (ActionPoint actionPoint in connectedActionPoints)
                {
                    if (!Object.op_Equality((Object)actionPoint, (Object)null) && (!actionPoint.IsNeutralCommand || actionPoint.IsReserved(agent)))
                    {
                        return(false);
                    }
                }
            }
            if (isRain && pt.AreaType != MapArea.AreaType.Indoor)
            {
                return(false);
            }
            MapArea ownerArea = pt.OwnerArea;

            if (ownerArea.ChunkID == chunkID)
            {
                return(false);
            }
            bool flag1;

            if (!availableArea.TryGetValue(ownerArea.AreaID, out flag1))
            {
                availableArea[ownerArea.AreaID] = flag1 = Singleton <Manager.Map> .Instance.CheckAvailableMapArea(ownerArea.AreaID);
            }
            if (!flag1 || !(!isFollow ? pt.AgentEventType : pt.AgentDateEventType).Contains(eventType))
            {
                return(false);
            }
            switch (eventType)
            {
            case EventType.Eat:
                StuffItem       carryingItem     = agent.AgentData.CarryingItem;
                AgentProfile    agentProfile     = Singleton <Resources> .Instance.AgentProfile;
                ItemIDKeyPair[] canStandEatItems = Singleton <Resources> .Instance.AgentProfile.CanStandEatItems;
                bool            flag2            = false;
                foreach (ItemIDKeyPair itemIdKeyPair in canStandEatItems)
                {
                    if (carryingItem.CategoryID == itemIdKeyPair.categoryID && carryingItem.ID == itemIdKeyPair.itemID)
                    {
                        flag2 = true;
                        break;
                    }
                }
                if (flag2)
                {
                    PoseKeyPair     eatDeskId1 = agentProfile.PoseIDTable.EatDeskID;
                    PoseKeyPair     eatDeskId2 = agentProfile.PoseIDTable.EatDeskID;
                    ActionPointInfo outInfo;
                    if (!pt.FindAgentActionPointInfo(EventType.Eat, eatDeskId1.poseID, out outInfo) && !pt.FindAgentActionPointInfo(EventType.Eat, eatDeskId2.poseID, out outInfo))
                    {
                        return(false);
                    }
                    break;
                }
                PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID;
                if (!pt.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out ActionPointInfo _))
                {
                    return(false);
                }
                break;

            case EventType.Search:
                SearchActionPoint searchActionPoint = pt as SearchActionPoint;
                if (Object.op_Inequality((Object)searchActionPoint, (Object)null))
                {
                    int registerId = searchActionPoint.RegisterID;
                    Dictionary <int, AIProject.SaveData.Environment.SearchActionInfo> searchActionLockTable = agent.AgentData.SearchActionLockTable;
                    AIProject.SaveData.Environment.SearchActionInfo searchActionInfo1;
                    if (!searchActionLockTable.TryGetValue(registerId, out searchActionInfo1))
                    {
                        AIProject.SaveData.Environment.SearchActionInfo searchActionInfo2 = new AIProject.SaveData.Environment.SearchActionInfo();
                        searchActionLockTable[registerId] = searchActionInfo2;
                        searchActionInfo1 = searchActionInfo2;
                    }
                    if (searchActionInfo1.Count >= searchCount)
                    {
                        return(false);
                    }
                    int       tableId  = searchActionPoint.TableID;
                    StuffItem itemInfo = agent.AgentData.EquipedSearchItem(tableId);
                    if (agent.SearchAreaID == 0)
                    {
                        if (tableId != 0 && tableId != 1 && tableId != 2 || !searchActionPoint.CanSearch(EventType.Search, itemInfo))
                        {
                            return(false);
                        }
                        break;
                    }
                    if (agent.SearchAreaID != searchActionPoint.TableID || !searchActionPoint.CanSearch(EventType.Search, itemInfo))
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case EventType.Warp:
                WarpPoint warpPoint = pt as WarpPoint;
                Dictionary <int, List <WarpPoint> > dictionary;
                List <WarpPoint> warpPointList;
                if (!Object.op_Inequality((Object)warpPoint, (Object)null) || !Singleton <Manager.Map> .Instance.WarpPointDic.TryGetValue(ownerArea.ChunkID, out dictionary) || (!dictionary.TryGetValue(warpPoint.TableID, out warpPointList) || warpPointList.Count < 2))
                {
                    return(false);
                }
                break;
            }
            if (SetDesiredActionOtherChunk._navMeshPath == null)
            {
                SetDesiredActionOtherChunk._navMeshPath = new NavMeshPath();
            }
            NavMeshHit navMeshHit;

            return(agent.NavMeshAgent.CalculatePath(pt.LocatedPosition, SetDesiredActionOtherChunk._navMeshPath) && SetDesiredActionOtherChunk._navMeshPath.get_status() == null && NavMesh.SamplePosition(pt.LocatedPosition, ref navMeshHit, sampleDistance, agent.NavMeshAgent.get_areaMask()));
        }