Ejemplo n.º 1
0
    public Reward getRandomReward()
    {
        int tong = 0;
        for (int i = 0; i < UuTien.Length; i++)
        {
            tong += UuTien[i];
        }
        int random = UnityEngine.Random.Range(1, tong + 1);
        TypeReward kq = TypeReward.WeaponCommon;
        for (int i = 0; i < NameOfRewards.Length; i++)
        {
            random -= UuTien[i];
            if (random <= 0)
            {
                kq = NameOfRewards[i];
                break;
            }
        }
        Debug.Log(kq.ToString());
        List<Reward> rewards = RewardManager.GetRewards(kq);
        if (rewards.Count == 0)
        {
            return null;
        }
        return rewards[UnityEngine.Random.Range(0, rewards.Count)];

    }
Ejemplo n.º 2
0
 public override bool EqualTypeByChest(TypeReward type)
 {
     if (type == TypeReward.Gold1 || type == TypeReward.Gold2 || type == TypeReward.Gold3)
     {
         return(false);
     }
     if (type == TypeReward.WeaponCommon && weapon.TypeOfWeapon == LevelWeapon.Common)
     {
         return(true);
     }
     if (type == TypeReward.WeaponEpic && weapon.TypeOfWeapon == LevelWeapon.Epic)
     {
         return(true);
     }
     if (type == TypeReward.WeaponRare && weapon.TypeOfWeapon == LevelWeapon.Rare)
     {
         return(true);
     }
     if (type == TypeReward.WeaponVeryRare && weapon.TypeOfWeapon == LevelWeapon.VeryRare)
     {
         return(true);
     }
     if (type == TypeReward.WeaponLegendary && weapon.TypeOfWeapon == LevelWeapon.Legendary)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
 public override bool EqualTypeByChest(TypeReward type)
 {
     if (Level == 1 && type == TypeReward.Gold1)
     {
         return(true);
     }
     if (Level == 2 && type == TypeReward.Gold2)
     {
         return(true);
     }
     if (Level == 3 && type == TypeReward.Gold3)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
    public static List <Reward> GetRewards(TypeReward type)
    {
        List <Reward> Rewards = new List <Reward>();

        // Thêm danh dách Reward
        Rewards.AddRange(AllRewards.rewardWeapons);
        Rewards.AddRange(AllRewards.rewardGolds);
        List <Reward> re = new List <Reward>();

        foreach (Reward reward in Rewards)
        {
            if (reward.EqualTypeByChest(type))
            {
                Debug.Log("Add:" + reward.Name);
                re.Add(reward);
            }
        }
        return(re);
    }
Ejemplo n.º 5
0
 public abstract bool EqualTypeByChest(TypeReward type);
Ejemplo n.º 6
0
 public override bool EqualTypeByChest(TypeReward type)
 {
     return(false);
 }