コード例 #1
0
        public void Refresh()
        {
            if (Object.op_Equality((Object)this._destination, (Object)null))
            {
                this._destination = ((Component)this).get_transform();
            }
            if (this._pointInfos != null)
            {
                this._pointInfos.Clear();
            }
            if (Object.op_Equality((Object)this.OwnerArea, (Object)null))
            {
                return;
            }
            this.AreaIDOnChunk = this.OwnerArea.AreaID;
            Dictionary <int, Dictionary <int, List <MerchantPointInfo> > > merchantPointInfoTable = Singleton <Resources> .Instance.Map.MerchantPointInfoTable;
            int key = !Singleton <Manager.Map> .IsInstance() ? 0 : Singleton <Manager.Map> .Instance.MapID;

            if (merchantPointInfoTable.ContainsKey(key) && merchantPointInfoTable[key].ContainsKey(this._actionID))
            {
                this._pointInfos = merchantPointInfoTable[key][this._actionID];
            }
            this._eventType = (Merchant.EventType) 0;
            foreach (MerchantPointInfo pointInfo in this._pointInfos)
            {
                this._eventType |= pointInfo.eventTypeMask;
            }
        }
コード例 #2
0
        public Tuple <Transform, Transform> GetEventPoint(
            Merchant.EventType eventType)
        {
            MerchantPointInfo pointInfo;

            return(!this.TryGetPointInfo(eventType, out pointInfo) ? new Tuple <Transform, Transform>(((Component)this).get_transform(), ((Component)this).get_transform()) : new Tuple <Transform, Transform>(this.GetBasePoint(pointInfo.baseNullName), this.GetRecoveryPoint(pointInfo.recoveryNullName)));
        }
コード例 #3
0
        public Tuple <MerchantPointInfo, Transform, Transform> GetEventInfo(
            Merchant.EventType eventType)
        {
            MerchantPointInfo pointInfo;

            this.TryGetPointInfo(eventType, out pointInfo);
            Transform basePoint     = this.GetBasePoint(pointInfo.baseNullName);
            Transform recoveryPoint = this.GetRecoveryPoint(pointInfo.recoveryNullName);

            return(new Tuple <MerchantPointInfo, Transform, Transform>(pointInfo, basePoint, recoveryPoint));
        }
コード例 #4
0
        public bool TryGetPointInfo(Merchant.EventType eventType, out MerchantPointInfo pointInfo)
        {
            List <MerchantPointInfo> outInfoList = ListPool <MerchantPointInfo> .Get();

            this.GetPointInfoList(eventType, ref outInfoList);
            if (outInfoList.IsNullOrEmpty <MerchantPointInfo>())
            {
                ListPool <MerchantPointInfo> .Release(outInfoList);

                pointInfo = new MerchantPointInfo();
                return(false);
            }
            pointInfo = outInfoList[Random.Range(0, outInfoList.Count)];
            ListPool <MerchantPointInfo> .Release(outInfoList);

            return(true);
        }
コード例 #5
0
        public virtual TaskStatus OnUpdate()
        {
            if (Object.op_Equality((Object)this.targetPoint, (Object)null))
            {
                return((TaskStatus)1);
            }
            MerchantPoint merchantPoint = !Object.op_Inequality((Object)this.mainTargetPoint, (Object)null) ? this.targetPoint : this.mainTargetPoint;

            if (this.Merchant.OpenAreaID < merchantPoint.AreaID)
            {
                return((TaskStatus)1);
            }
            Merchant.EventType eventType = merchantPoint.EventType;
            if (!NavMesh.CalculatePath(this.Merchant.Position, this.targetPoint.Destination, this.Merchant.NavMeshAgent.get_areaMask(), this.navMeshPath) || this.navMeshPath.get_status() != null)
            {
                return((TaskStatus)1);
            }
            return((eventType & this._matchType) == this._matchType ? (TaskStatus)2 : (TaskStatus)1);
        }
コード例 #6
0
 public void GetPointInfoList(
     Merchant.EventType eventType,
     ref List <MerchantPointInfo> outInfoList)
 {
     if (eventType == (Merchant.EventType) 0)
     {
         return;
     }
     outInfoList.Clear();
     foreach (MerchantPointInfo pointInfo in this._pointInfos)
     {
         if (pointInfo.eventTypeMask == eventType)
         {
             if (outInfoList == null)
             {
                 outInfoList = new List <MerchantPointInfo>();
             }
             outInfoList.Add(pointInfo);
         }
     }
 }
コード例 #7
0
        private bool IsMatchPoint(MerchantPoint _point, bool _isMiddlePoint)
        {
            if (Object.op_Equality((Object)_point, (Object)null))
            {
                return(false);
            }
            Merchant.EventType eventType    = !_isMiddlePoint ? Merchant.EventType.Search : Merchant.EventType.Wait;
            MerchantActor      merchant     = this.Merchant;
            MerchantData       merchantData = merchant.MerchantData;
            int           openAreaId        = merchant.OpenAreaID;
            int           pointAreaId       = merchantData.PointAreaID;
            int           pointGroupId      = merchantData.PointGroupID;
            MerchantPoint prevMerchantPoint = this.PrevMerchantPoint;

            if (openAreaId < _point.AreaID || (_point.EventType & eventType) != eventType || _point.AreaID != pointAreaId)
            {
                return(false);
            }
            if (_isMiddlePoint)
            {
                return(_point.GroupID == 0);
            }
            return(_point.GroupID != pointGroupId || Object.op_Inequality((Object)_point, (Object)prevMerchantPoint));
        }
コード例 #8
0
        public Transform GetRecoveryPoint(Merchant.EventType eventType)
        {
            MerchantPointInfo pointInfo;

            return(!this.TryGetPointInfo(eventType, out pointInfo) ? ((Component)this).get_transform() : this.GetRecoveryPoint(pointInfo.recoveryNullName));
        }