public void GainLevel_HasNoRewardForLevel_NoRewardsGiven() { int[] xplevels = new int[] { 0, 100 }; LevelRewarder levelReward = new LevelRewarder(xplevels); Player player = new Player(null, null, null, levelReward); this.Engine.AddActor(player); this.Engine.Update(); player.AddXP(100); Assert.AreEqual(2, levelReward.CurrentLevel); }
public void GainLevel_ZeroXPRequriedForLevelUp_RewardGiven() { bool rewardGiven = false; int[] xplevels = new int[]{0}; LevelRewarder levelReward = new LevelRewarder(xplevels); Player player = new Player(null, null, null, levelReward); levelReward.SetReward(1,rw => rewardGiven = true); this.Engine.AddActor(player); this.Engine.Update(); Assert.IsTrue(rewardGiven); }
public void GainLevel_HasAReward_RewardGiven() { bool rewardGiven = false; int[] xplevels = new int[] { 0, 100 }; LevelRewarder levelReward = new LevelRewarder(xplevels); Player player = new Player(null, null, null, levelReward); levelReward.SetReward(2, rw => rewardGiven = true); this.Engine.AddActor(player); this.Engine.Update(); player.AddXP(100); Assert.IsTrue(rewardGiven); }
public Player(GameLibrary lib, Hand hand, ManaStorage manaStorage,LevelRewarder rewarder) { this.CurrentXP = 0; this.Rewarder = rewarder; if (this.Rewarder != null) Rewarder.Owner = this; Library = lib; if(lib!=null) Library.Owner = this; Hand = hand; ManaStorage = manaStorage; if(manaStorage != null) ManaStorage.Owner = this; }
public void GainLevel_GetsXpForMultipleLevels_RewardsForAllLevelsGiven() { bool FirstRewardGiven = false; bool SecondRewardGiven = false; int[] xplevels = new int[] { 0, 100, 200 }; LevelRewarder levelReward = new LevelRewarder(xplevels); Player player = new Player(null, null, null, levelReward); levelReward.SetReward(2, rw => FirstRewardGiven = true); levelReward.SetReward(3, rw => SecondRewardGiven = true); this.Engine.AddActor(player); this.Engine.Update(); player.AddXP(200); Assert.IsTrue(FirstRewardGiven); Assert.IsTrue(SecondRewardGiven); }
public Player(GameLibrary lib, Hand hand, ManaStorage manaStorage, LevelRewarder rewarder) { this.CurrentXP = 0; this.Rewarder = rewarder; if (this.Rewarder != null) { Rewarder.Owner = this; } Library = lib; if (lib != null) { Library.Owner = this; } Hand = hand; ManaStorage = manaStorage; if (manaStorage != null) { ManaStorage.Owner = this; } }