Пример #1
0
        public static KillReward GetRewardFrom(IKillRewardGiver giver, int teamSize)
        {
            float rewardRatio = 1;

            if (teamSize == 1)
            {
                rewardRatio = 0.7f;
            }
            if (teamSize == 2)
            {
                rewardRatio = 0.6f;
            }

            var killReward = new KillReward();

            killReward.MainExp  = (int)(giver.KillExp * rewardRatio);
            killReward.MainGold = (int)(giver.KillGold * rewardRatio);

            if (teamSize > 0)
            {
                killReward.SubExp  = (int)(giver.KillExp * ((1.0f - rewardRatio) / teamSize));
                killReward.SubGold = (int)(giver.KillGold * ((1.0f - rewardRatio) / teamSize));
            }

            return(killReward);
        }
Пример #2
0
        public static void GiveRewardTo(IKillRewardTaker taker, KillReward killReward)
        {
            taker.Exp.Add(killReward.MainExp);
            taker.Gold.Add(killReward.MainGold);

            foreach (var teammate in taker.RewardTeammates)
            {
                teammate.Exp.Add(killReward.SubExp);
                teammate.Gold.Add(killReward.SubGold);
            }
        }
Пример #3
0
 public static void GiveSubRewardTo(IKillRewardTaker taker, KillReward killReward)
 {
     taker.Exp.Add(killReward.SubExp);
     taker.Gold.Add(killReward.SubGold);
 }
Пример #4
0
 public static void GiveMainRewardTo(IKillRewardTaker taker, KillReward killReward)
 {
     taker.Exp.Add(killReward.MainExp);
     taker.Gold.Add(killReward.MainGold);
 }