Exemple #1
0
        public int AreaBombOddLimit = 300;  //炸弹倍数限制,超过倍数之后的鱼不参与赔率计算

        public override int GetFishOddBonus(Bullet bullet)
        {
            var bulletTs = bullet.transform;
            //生成碰撞范围
            var results = Physics.SphereCastAll(bulletTs.position - Bullet.ColliderOffsetZ, AreaBombRadius, Vector3.forward);

            //计算是否爆炸
            FishAffect = new List <Fish> {
                this
            };
            var oddTotalForCaclDieratio = 0; //计算死亡几率的倍率

            foreach (var hitObj in results)  //需要碰撞的鱼
            {
                var tmpFish = hitObj.transform.GetComponent <Fish>();
                if (tmpFish != null && tmpFish.Attackable && tmpFish.HittableType == HittableType.Normal)
                {
                    FishAffect.Add(tmpFish);
                    var otherOddBonus = HitProcessor.GetFishOddBonus(bullet, tmpFish, this);//用于赔率计算;
                    oddTotalForCaclDieratio += otherOddBonus;
                    tmpFish.OddBonus         = oddTotalForCaclDieratio;
                }
                if (oddTotalForCaclDieratio > AreaBombOddLimit)
                {
                    break;
                }
            }
            return(oddTotalForCaclDieratio);
        }
Exemple #2
0
        public Fish[] Prefab_SameTypeBombAffect;//如果是同类鱼炸弹,是炸那个类型的
        public override int GetFishOddBonus(Bullet bullet)
        {
            var prefabAffects    = Prefab_SameTypeBombAffect;
            var numTypeToBomb    = prefabAffects.Length;
            var fishDicts        = new Dictionary <int, Fish> [numTypeToBomb];
            var fishTypeIndexMap = GameMain.Singleton.FishGenerator.FishTypeIndexMap;

            for (var i = 0; i < numTypeToBomb; ++i)
            {
                var type = prefabAffects[i].TypeIndex;
                if (!fishTypeIndexMap.ContainsKey(type))
                {
                    continue;
                }
                fishDicts[i] = fishTypeIndexMap[type];
            }
            //计算是否爆炸
            FishAffect = new List <Fish> {
                this
            };

            OddBonus = HitProcessor.GetFishOddBonus(bullet, this, this);
            var oddTotalForCaclDieratio = OddBonus;//fishFirst.Odds * oddMulti + GetFishOddForDieRatio(bulletOwner, b, fishFirst);//用于赔率计算

            foreach (var fishDict in fishDicts)
            {
                if (fishDict == null)
                {
                    continue;
                }
                foreach (var fKv in fishDict)
                {
                    var tmpFish = fKv.Value;
                    if (!tmpFish.Attackable || tmpFish.HittableType != HittableType.Normal)
                    {
                        continue;
                    }
                    FishAffect.Add(tmpFish);

                    var otherOddBonus = HitProcessor.GetFishOddBonus(bullet, tmpFish, this);
                    tmpFish.OddBonus         = otherOddBonus;
                    oddTotalForCaclDieratio += otherOddBonus;
                }
            }
            return(oddTotalForCaclDieratio);
        }
Exemple #3
0
 public virtual int GetFishOddBonus(Bullet bullet)
 {
     OddBonus = HitProcessor.GetFishOddBonus(bullet, this, this);;  //显示倍率
     return(OddBonus);
 }