private static void CreateList(
            AgentActor agent,
            List <ActionPoint> source,
            List <ActionPoint> destination,
            EventType eventType,
            bool isRain)
        {
            int   searchCount                = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount;
            float meshSampleDistance         = Singleton <Resources> .Instance.LocomotionProfile.ActionPointNavMeshSampleDistance;
            Dictionary <int, bool> toRelease = DictionaryPool <int, bool> .Get();

            foreach (ActionPoint actionPoint1 in source)
            {
                if (!Object.op_Equality((Object)actionPoint1, (Object)null) && !Object.op_Equality((Object)actionPoint1.OwnerArea, (Object)null) && (actionPoint1.IsNeutralCommand && !actionPoint1.IsReserved(agent)))
                {
                    List <ActionPoint> connectedActionPoints = actionPoint1.ConnectedActionPoints;
                    if (connectedActionPoints.IsNullOrEmpty <ActionPoint>())
                    {
                        bool flag = false;
                        foreach (ActionPoint actionPoint2 in connectedActionPoints)
                        {
                            if (!Object.op_Equality((Object)actionPoint2, (Object)null) && (!actionPoint2.IsNeutralCommand || actionPoint2.IsReserved(agent)))
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (flag)
                        {
                            continue;
                        }
                    }
                    if (!isRain || actionPoint1.AreaType == MapArea.AreaType.Indoor)
                    {
                        MapArea ownerArea = actionPoint1.OwnerArea;
                        bool    flag;
                        if (!toRelease.TryGetValue(ownerArea.AreaID, out flag))
                        {
                            toRelease[ownerArea.AreaID] = flag = Singleton <Manager.Map> .Instance.CheckAvailableMapArea(ownerArea.AreaID);
                        }
                        if (flag && actionPoint1.PlayerEventType.Contains(eventType))
                        {
                            if (eventType == EventType.Search)
                            {
                                SearchActionPoint searchActionPoint = actionPoint1 as SearchActionPoint;
                                if (Object.op_Inequality((Object)searchActionPoint, (Object)null))
                                {
                                    int registerId = searchActionPoint.RegisterID;
                                    Dictionary <int, Environment.SearchActionInfo> searchActionLockTable = agent.AgentData.SearchActionLockTable;
                                    Environment.SearchActionInfo searchActionInfo1;
                                    if (!searchActionLockTable.TryGetValue(registerId, out searchActionInfo1))
                                    {
                                        Environment.SearchActionInfo searchActionInfo2 = new Environment.SearchActionInfo();
                                        searchActionLockTable[registerId] = searchActionInfo2;
                                        searchActionInfo1 = searchActionInfo2;
                                    }
                                    if (searchActionInfo1.Count < searchCount)
                                    {
                                        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))
                                            {
                                                continue;
                                            }
                                        }
                                        else if (agent.SearchAreaID != searchActionPoint.TableID || !searchActionPoint.CanSearch(EventType.Search, itemInfo))
                                        {
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                            }
                            if (SetDesiredPAction._navMeshPath == null)
                            {
                                SetDesiredPAction._navMeshPath = new NavMeshPath();
                            }
                            NavMeshHit navMeshHit;
                            if (agent.NavMeshAgent.CalculatePath(actionPoint1.LocatedPosition, SetDesiredPAction._navMeshPath) && SetDesiredPAction._navMeshPath.get_status() == null && NavMesh.SamplePosition(actionPoint1.LocatedPosition, ref navMeshHit, meshSampleDistance, agent.NavMeshAgent.get_areaMask()))
                            {
                                destination.Add(actionPoint1);
                            }
                        }
                    }
                }
            }
            DictionaryPool <int, bool> .Release(toRelease);
        }
Пример #2
0
        private static void CreateList(
            AgentActor agent,
            List <ActionPoint> source,
            List <ActionPoint> destination,
            EventType eventType,
            bool isFollow)
        {
            int searchCount = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount;
            Dictionary <int, bool> toRelease = DictionaryPool <int, bool> .Get();

            foreach (ActionPoint actionPoint1 in source)
            {
                if (!Object.op_Equality((Object)actionPoint1, (Object)null) && !Object.op_Equality((Object)actionPoint1.OwnerArea, (Object)null) && (actionPoint1.IsNeutralCommand && !actionPoint1.IsReserved(agent)))
                {
                    List <ActionPoint> connectedActionPoints = actionPoint1.ConnectedActionPoints;
                    if (!connectedActionPoints.IsNullOrEmpty <ActionPoint>())
                    {
                        bool flag = false;
                        foreach (ActionPoint actionPoint2 in connectedActionPoints)
                        {
                            if (!Object.op_Equality((Object)actionPoint2, (Object)null) && (!actionPoint2.IsNeutralCommand || actionPoint2.IsReserved(agent)))
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (flag)
                        {
                            continue;
                        }
                    }
                    MapArea ownerArea = actionPoint1.OwnerArea;
                    bool    flag1;
                    if (!toRelease.TryGetValue(ownerArea.AreaID, out flag1))
                    {
                        toRelease[ownerArea.AreaID] = flag1 = Singleton <Manager.Map> .Instance.CheckAvailableMapArea(ownerArea.AreaID);
                    }
                    if (flag1 && (!isFollow ? actionPoint1.AgentEventType : actionPoint1.AgentDateEventType).Contains(eventType))
                    {
                        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;
                                }
                            }
                            ActionPointInfo outInfo;
                            if (flag2)
                            {
                                PoseKeyPair eatDeskId1 = agentProfile.PoseIDTable.EatDeskID;
                                PoseKeyPair eatDeskId2 = agentProfile.PoseIDTable.EatDeskID;
                                if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId1.poseID, out outInfo) || actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId2.poseID, out outInfo))
                                {
                                    break;
                                }
                                continue;
                            }
                            PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID;
                            if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out outInfo))
                            {
                                break;
                            }
                            continue;

                        case EventType.Search:
                            SearchActionPoint searchActionPoint = actionPoint1 as SearchActionPoint;
                            if (Object.op_Inequality((Object)searchActionPoint, (Object)null))
                            {
                                int registerId = searchActionPoint.RegisterID;
                                Dictionary <int, Environment.SearchActionInfo> searchActionLockTable = agent.AgentData.SearchActionLockTable;
                                Environment.SearchActionInfo searchActionInfo1;
                                if (!searchActionLockTable.TryGetValue(registerId, out searchActionInfo1))
                                {
                                    Environment.SearchActionInfo searchActionInfo2 = new Environment.SearchActionInfo();
                                    searchActionLockTable[registerId] = searchActionInfo2;
                                    searchActionInfo1 = searchActionInfo2;
                                }
                                if (searchActionInfo1.Count < searchCount)
                                {
                                    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))
                                        {
                                            continue;
                                        }
                                        break;
                                    }
                                    if (agent.SearchAreaID != searchActionPoint.TableID || !searchActionPoint.CanSearch(EventType.Search, itemInfo))
                                    {
                                        continue;
                                    }
                                    break;
                                }
                                continue;
                            }
                            break;
                        }
                        if (ExistsDesiredActionPoint._navMeshPath == null)
                        {
                            ExistsDesiredActionPoint._navMeshPath = new NavMeshPath();
                        }
                        if (agent.NavMeshAgent.CalculatePath(actionPoint1.LocatedPosition, ExistsDesiredActionPoint._navMeshPath) && ExistsDesiredActionPoint._navMeshPath.get_status() == null)
                        {
                            destination.Add(actionPoint1);
                        }
                    }
                }
            }
            DictionaryPool <int, bool> .Release(toRelease);
        }
        private static void CreateList(
            AgentActor agent,
            List <ActionPoint> source,
            List <ActionPoint> destination,
            EventType eventType,
            bool isFollow,
            bool isRain)
        {
            int   searchCount        = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount;
            float meshSampleDistance = Singleton <Resources> .Instance.LocomotionProfile.ActionPointNavMeshSampleDistance;

            foreach (ActionPoint actionPoint1 in source)
            {
                if (!Object.op_Equality((Object)actionPoint1, (Object)null) && !Object.op_Equality((Object)actionPoint1.OwnerArea, (Object)null) && (actionPoint1.IsNeutralCommand && !actionPoint1.IsReserved(agent)))
                {
                    List <ActionPoint> connectedActionPoints = actionPoint1.ConnectedActionPoints;
                    if (!connectedActionPoints.IsNullOrEmpty <ActionPoint>())
                    {
                        bool flag = false;
                        foreach (ActionPoint actionPoint2 in connectedActionPoints)
                        {
                            if (!Object.op_Equality((Object)actionPoint2, (Object)null) && (!actionPoint2.IsNeutralCommand || actionPoint2.IsReserved(agent)))
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (flag)
                        {
                            continue;
                        }
                    }
                    if ((!isRain || actionPoint1.AreaType == MapArea.AreaType.Indoor) && (!isFollow ? actionPoint1.AgentEventType : actionPoint1.AgentDateEventType).Contains(eventType))
                    {
                        switch (eventType)
                        {
                        case 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;
                                }
                            }
                            ActionPointInfo outInfo;
                            if (flag)
                            {
                                PoseKeyPair eatDeskId1 = agentProfile.PoseIDTable.EatDeskID;
                                PoseKeyPair eatDeskId2 = agentProfile.PoseIDTable.EatDeskID;
                                if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId1.poseID, out outInfo) || actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId2.poseID, out outInfo))
                                {
                                    break;
                                }
                                continue;
                            }
                            PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID;
                            if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out outInfo))
                            {
                                break;
                            }
                            continue;

                        case EventType.Search:
                            SearchActionPoint searchActionPoint = actionPoint1 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)
                                {
                                    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))
                                        {
                                            continue;
                                        }
                                        break;
                                    }
                                    if (agent.SearchAreaID != searchActionPoint.TableID || !searchActionPoint.CanSearch(EventType.Search, itemInfo))
                                    {
                                        continue;
                                    }
                                    break;
                                }
                                continue;
                            }
                            break;

                        case EventType.Warp:
                            WarpPoint warpPoint = actionPoint1 as WarpPoint;
                            Dictionary <int, List <WarpPoint> > dictionary;
                            List <WarpPoint> warpPointList;
                            if (!Object.op_Inequality((Object)warpPoint, (Object)null) || !Singleton <Manager.Map> .Instance.WarpPointDic.TryGetValue(warpPoint.OwnerArea.ChunkID, out dictionary) || (!dictionary.TryGetValue(warpPoint.TableID, out warpPointList) || warpPointList.Count < 2))
                            {
                                continue;
                            }
                            break;
                        }
                        if (SetDesiredActionOtherChange._navMeshPath == null)
                        {
                            SetDesiredActionOtherChange._navMeshPath = new NavMeshPath();
                        }
                        NavMeshHit navMeshHit;
                        if (agent.NavMeshAgent.CalculatePath(actionPoint1.LocatedPosition, SetDesiredActionOtherChange._navMeshPath) && SetDesiredActionOtherChange._navMeshPath.get_status() == null && NavMesh.SamplePosition(actionPoint1.LocatedPosition, ref navMeshHit, meshSampleDistance, agent.NavMeshAgent.get_areaMask()))
                        {
                            destination.Add(actionPoint1);
                        }
                    }
                }
            }
        }
Пример #4
0
        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);
        }
Пример #5
0
 private void Start()
 {
     this._searchActionPoint = (SearchActionPoint)((Component)this).GetComponent <SearchActionPoint>();
 }
        protected override void InitSub()
        {
            CommonDefine.CommonIconGroup icon          = Singleton <Resources> .Instance.CommonDefine.Icon;
            EventType playerEventMask                  = Singleton <Resources> .Instance.DefinePack.MapDefines.PlayerEventMask;
            List <CommandLabel.CommandInfo> toRelease1 = ListPool <CommandLabel.CommandInfo> .Get();

            foreach (KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > keyValuePair in ActionPoint.LabelTable)
            {
                KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > pair = keyValuePair;
                SearchActionPoint searchActionPoint = this;
                if (this._playerEventType.Contains(pair.Key) && playerEventMask.Contains(pair.Key) && AIProject.Definitions.Action.NameTable.TryGetValue(pair.Key, out ValueTuple <int, string> _))
                {
                    ActionPointInfo actionPointInfo = this._playerInfos.Find((Predicate <ActionPointInfo>)(x => x.eventTypeMask == pair.Key));
                    string          actionName      = actionPointInfo.actionName;
                    Sprite          sprite;
                    if (pair.Key == EventType.Search)
                    {
                        if (actionPointInfo.searchAreaID > -1)
                        {
                            this._tableID = actionPointInfo.searchAreaID;
                        }
                        if (actionPointInfo.gradeValue > -1 && actionPointInfo.gradeValue > this._grade)
                        {
                            this._grade = actionPointInfo.gradeValue;
                        }
                        Dictionary <int, int> dictionary;
                        if (Singleton <Resources> .Instance.itemIconTables.EquipmentIconTable.TryGetValue(this._tableID, out dictionary))
                        {
                            int key;
                            if (dictionary.TryGetValue(this._grade, out key))
                            {
                                Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(key, out sprite);
                            }
                            else
                            {
                                sprite = (Sprite)null;
                            }
                        }
                        else
                        {
                            sprite = (Sprite)null;
                        }
                    }
                    else
                    {
                        Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(actionPointInfo.iconID, out sprite);
                    }
                    Transform transform = ((Component)this).get_transform().FindLoop(actionPointInfo.labelNullName)?.get_transform() ?? ((Component)this).get_transform();
                    toRelease1.Add(new CommandLabel.CommandInfo()
                    {
                        Text             = actionName,
                        Icon             = sprite,
                        IsHold           = pair.Key == EventType.Search,
                        TargetSpriteInfo = icon.ActionSpriteInfo,
                        Transform        = transform,
                        Condition        = (Func <PlayerActor, bool>)(x => closure_0.CanAction(x, pair.Key, actionPointInfo.searchAreaID)),
                        ErrorText        = (Func <PlayerActor, string>)(x => closure_0.ErrorText(x, pair.Key, actionPointInfo.searchAreaID)),
                        CoolTimeFillRate = (Func <float>)(() =>
                        {
                            AIProject.SaveData.Environment.SearchActionInfo searchActionInfo;
                            if (!Singleton <Game> .Instance.Environment.SearchActionLockTable.TryGetValue(closure_0.RegisterID, out searchActionInfo))
                            {
                                return(0.0f);
                            }
                            EnvironmentProfile environmentProfile = Singleton <Manager.Map> .Instance.EnvironmentProfile;
                            return(searchActionInfo.Count < environmentProfile.SearchCount ? 0.0f : 1f - searchActionInfo.ElapsedTime / environmentProfile.SearchCoolTimeDuration);
                        }),
                        Event = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)closure_0))
                    });
                }
            }
            this._labels = toRelease1.ToArray();
            ListPool <CommandLabel.CommandInfo> .Release(toRelease1);

            for (int key1 = 0; key1 < 2; ++key1)
            {
                List <CommandLabel.CommandInfo> toRelease2 = ListPool <CommandLabel.CommandInfo> .Get();

                foreach (KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > keyValuePair in ActionPoint.DateLabelTable)
                {
                    KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > pair = keyValuePair;
                    SearchActionPoint          searchActionPoint = this;
                    List <DateActionPointInfo> dateActionPointInfoList;
                    if (this._playerDateEventType[key1].Contains(pair.Key) && AIProject.Definitions.Action.NameTable.TryGetValue(pair.Key, out ValueTuple <int, string> _) && this._playerDateInfos.TryGetValue(key1, out dateActionPointInfoList))
                    {
                        DateActionPointInfo actionPointInfo = dateActionPointInfoList.Find((Predicate <DateActionPointInfo>)(x => x.eventTypeMask == pair.Key));
                        string actionName = actionPointInfo.actionName;
                        Sprite sprite;
                        if (pair.Key == EventType.Search)
                        {
                            if (actionPointInfo.searchAreaID > -1)
                            {
                                this._tableID = actionPointInfo.searchAreaID;
                            }
                            if (actionPointInfo.gradeValue > -1 && actionPointInfo.gradeValue > this._grade)
                            {
                                this._grade = actionPointInfo.gradeValue;
                            }
                            Dictionary <int, int> dictionary;
                            if (Singleton <Resources> .Instance.itemIconTables.EquipmentIconTable.TryGetValue(this._tableID, out dictionary))
                            {
                                int key2;
                                if (dictionary.TryGetValue(this._grade, out key2))
                                {
                                    Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(key2, out sprite);
                                }
                                else
                                {
                                    sprite = (Sprite)null;
                                }
                            }
                            else
                            {
                                sprite = (Sprite)null;
                            }
                        }
                        else
                        {
                            Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(actionPointInfo.iconID, out sprite);
                        }
                        Transform transform = ((Component)this).get_transform().FindLoop(actionPointInfo.labelNullName)?.get_transform() ?? ((Component)this).get_transform();
                        toRelease2.Add(new CommandLabel.CommandInfo()
                        {
                            Text             = actionName,
                            Icon             = sprite,
                            IsHold           = pair.Key == EventType.Search,
                            TargetSpriteInfo = icon.ActionSpriteInfo,
                            Transform        = transform,
                            Condition        = (Func <PlayerActor, bool>)(x => closure_1.CanAction(x, pair.Key, actionPointInfo.searchAreaID)),
                            ErrorText        = (Func <PlayerActor, string>)(x => closure_1.ErrorText(x, pair.Key, actionPointInfo.searchAreaID)),
                            CoolTimeFillRate = (Func <float>)(() =>
                            {
                                AIProject.SaveData.Environment.SearchActionInfo searchActionInfo;
                                if (!Singleton <Game> .Instance.Environment.SearchActionLockTable.TryGetValue(closure_1.RegisterID, out searchActionInfo))
                                {
                                    return(0.0f);
                                }
                                EnvironmentProfile environmentProfile = Singleton <Manager.Map> .Instance.EnvironmentProfile;
                                return(searchActionInfo.Count < environmentProfile.SearchCount ? 0.0f : 1f - searchActionInfo.ElapsedTime / environmentProfile.SearchCoolTimeDuration);
                            }),
                            Event = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)closure_1))
                        });
                    }
                }
                this._dateLabels[key1] = toRelease2.ToArray();
                ListPool <CommandLabel.CommandInfo> .Release(toRelease2);
            }
            List <CommandLabel.CommandInfo> toRelease3 = ListPool <CommandLabel.CommandInfo> .Get();

            foreach (KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > keyValuePair in ActionPoint.SickLabelTable)
            {
                KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > pair = keyValuePair;
                SearchActionPoint searchActionPoint = this;
                if (this._playerEventType.Contains(pair.Key) && playerEventMask.Contains(pair.Key) && AIProject.Definitions.Action.NameTable.TryGetValue(pair.Key, out ValueTuple <int, string> _))
                {
                    toRelease3.Add(new CommandLabel.CommandInfo()
                    {
                        Text             = pair.Value.Item2,
                        Icon             = (Sprite)null,
                        IsHold           = false,
                        TargetSpriteInfo = icon.ActionSpriteInfo,
                        Transform        = ((Component)this).get_transform(),
                        Event            = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)searchActionPoint))
                    });
                }
            }
            this._sickLabels = toRelease3.ToArray();
            ListPool <CommandLabel.CommandInfo> .Release(toRelease3);

            if (!this._playerInfos.IsNullOrEmpty <ActionPointInfo>() && this._playerInfos.Exists((Predicate <ActionPointInfo>)(x => x.eventTypeMask == EventType.Search)) || !this._agentEventType.Contains(EventType.Search))
            {
                return;
            }
            this._tableID = this._agentInfos.Find((Predicate <ActionPointInfo>)(x => x.eventTypeMask == EventType.Search)).searchAreaID;
        }
Пример #7
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()));
        }