Ejemplo n.º 1
0
        public static Weapon CalculateWeaponReward(WeaponReward weaponReward, int playedGames, int numberOfGames)
        {
            if (!weaponReward.random)
            {
                return(weaponReward.reward);
            }

            List <Weapon> weapons = Weapon.GetWeaponTypes();

            weapons.Sort((w1, w2) => (w1.attackDamage.Value * w1.Attacks() * w1.range / 4) > (w2.attackDamage.Value * w2.Attacks() * w2.range / 4) ? 1 : -1);
            return(weapons[World.World.random.Next(weapons.Count / numberOfGames * playedGames + weaponReward.rarity,
                                                   Math.Min(weapons.Count / numberOfGames * (playedGames + 1) + weaponReward.rarity, weapons.Count))]);
        }
Ejemplo n.º 2
0
 void Awake()
 {
     _instance = this;
 }