Exemple #1
0
        protected override bool BehindLimit(GenerateData data)
        {
            var fishPrefab       = data.FishPerfab;
            var fishTypeIndexMap = Generator.FishTypeIndexMap;
            var type             = fishPrefab.TypeIndex;
            var map = fishTypeIndexMap.ContainsKey(type) ? fishTypeIndexMap[type] : null;

            return(map != null && map.Count > 0);
        }
Exemple #2
0
        protected override GenerateData RandomData()
        {
            if (_generateQueue.Count < 1)
            {
                var tmpFishGdLst = Datas.ToList();
                tmpFishGdLst.Sort((a, b) => Random.Range(0, a.Weight) < Random.Range(0, b.Weight) ? 1 : -1);
                var gdNum = Datas.Length; //队列70%的鱼

                foreach (var fgd in tmpFishGdLst)
                {
                    _generateQueue.Enqueue(fgd);
                    if (--gdNum < 0)
                    {
                        break;
                    }
                }
            }
            _lastFish = _generateQueue.Dequeue();
            return(_lastFish);
        }
Exemple #3
0
 /// <summary>
 /// 生成鱼后限制
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 protected virtual bool BehindLimit(GenerateData data)
 {
     return(false);
 }