public void StatAchievement_NotCompleted() { var achievement = new StatMAchievementTest(2); MEvents.RaiseEvent(new TestEvent(1)); Assert.IsFalse(achievement.IsCompleted); }
public void StatAchievement_PartCompleted() { var achievement = new StatMAchievementTest(2); MEvents.RaiseEvent(new TestEvent(1)); Assert.IsTrue(Math.Abs(achievement.Progress - 0.5f) < 0.0001f); }
public void StatAchievement_CompleteCorrect() { var achievement = new StatMAchievementTest(1); MEvents.RaiseEvent(new TestEvent(1)); Assert.IsTrue(achievement.IsCompleted); }
public void CompositeAchievement_CompletesFor1Objective() { var objective = new StatMAchievementTest(1); var achievement = new MCompositeAchievement("", objective); MEvents.RaiseEvent(new TestEvent(1)); Assert.IsTrue(achievement.IsCompleted); }
public void CompositeAchievement_PartialCompletion() { var objective1 = new StatMAchievementTest(1); var objective2 = new StatMAchievementTest(2); var achievement = new MCompositeAchievement("", objective1, objective2); MEvents.RaiseEvent(new TestEvent(1)); Assert.IsTrue(Math.Abs(achievement.Progress - 0.5f) < 0.0001f); }
public void RemovingEventListener() { MEvents.Add <TestEvent>(TestEventListener); MEvents.RaiseEvent(new TestEvent(1)); LogAssert.Expect(LogType.Log, "TestEvent" + 1); MEvents.Remove <TestEvent>(TestEventListener); MEvents.RaiseEvent(new TestEvent(1)); LogAssert.NoUnexpectedReceived(); }
public bool TryUpgradeCapacity() { if (Level >= _capacity.Count - 1) { MEvents.RaiseEvent(new UpgradableCurrencyUpgradeFailedEvent(this)); return(false); } Level++; MEvents.RaiseEvent(new UpgradableCurrencyUpgradeSuccessEvent(this)); return(true); }
public void CompositeAchievement_NestedCompletion() { var objective1 = new StatMAchievementTest(1); var objective2 = new StatMAchievementTest(2); var objective3 = new MCompositeAchievement("", objective1, objective2); var objective4 = new StatMAchievementTest(3); var achievement = new MCompositeAchievement("", objective3, objective4); MEvents.RaiseEvent(new TestEvent(3)); Assert.IsTrue(achievement.IsCompleted); }
public void RaisingEvent() { MEvents.Add <TestEvent>(TestEventListener); MEvents.RaiseEvent(new TestEvent(0)); LogAssert.Expect(LogType.Log, "TestEvent0"); }