public void GetAllLevelsInWorld_3LevelsNoAttempts() { //Arrange Level level1 = GetTestLevel(); Level level2 = GetTestLevel(sequenceInWorld: 2); Level level3 = GetTestLevel(sequenceInWorld: 3); Setup3TiersForLevel(level1.Id); Setup3TiersForLevel(level2.Id); Setup3TiersForLevel(level3.Id); LevelProvider provider = new LevelProvider(_context); //Act ICollection <LevelDto> levels = provider.GetAllLevelsInWorld(_testWorldId); //Assert int expectedCount = 3; int expectedTier1Reward = 1; int expectedTier2Reward = 2; int expectedTier3Reward = 3; Assert.AreEqual(expectedCount, levels.Count); Assert.AreEqual(expectedTier1Reward, levels.Single(l => l.Sequence == 1).Tier1Reward); Assert.AreEqual(expectedTier2Reward, levels.Single(l => l.Sequence == 2).Tier2Reward); Assert.AreEqual(expectedTier3Reward, levels.Single(l => l.Sequence == 1).Tier3Reward); }
public void GetAllLevelsInWorld_3LevelsLevel1CompletedTie() { //Arrange Level level1 = GetTestLevel(); Level level2 = GetTestLevel(sequenceInWorld: 2); Level level3 = GetTestLevel(sequenceInWorld: 3); Setup3TiersForLevel(level1.Id); Setup3TiersForLevel(level2.Id); Setup3TiersForLevel(level3.Id); Player player = GetTestPlayer(); LevelAttempt attemptFailed = GetTestLevelAttempt(player.Id, level1.Id, score: 1022, timeSeconds: 543, completed: true); LevelAttempt attemptSuccess = GetTestLevelAttempt(player.Id, level1.Id, score: 1022, timeSeconds: 325, completed: true); LevelProvider provider = new LevelProvider(_context); //Act ICollection <LevelDto> levels = provider.GetAllLevelsInWorld(_testWorldId); //Assert int expectedCount = 3; int expectedLevel1HighScore = 1022; int expectedLevel2HighScore = 0; Assert.AreEqual(expectedCount, levels.Count); Assert.AreEqual(expectedLevel1HighScore, levels.Single(l => l.Sequence == 1).PlayerHighScore); Assert.AreEqual(expectedLevel2HighScore, levels.Single(l => l.Sequence == 2).PlayerHighScore); }
void Start() { _storeData = GetStoreData(); _gamePassport = new GamePassport(_storeData); _gamePassport.ResetProgress(); Debug.Log($"Current Level: {_gamePassport.GetLevel()}"); _levelProvider = new LevelProvider(_gamePassport); ShowMenu(); }
// public RenderTarget RenderTarget { get { return GameWindow.RenderTarget2D; } } public GameScene(IGraphicsRenderer graphicsRenderer, ITextRenderer textRenderer, LevelProvider levelProvider, Player player, GameStateManager gameStateManager, World world) : base(graphicsRenderer, textRenderer) { kernel = NinjectFactory.Kernel; this.levelProvider = levelProvider; this.player = player; this.GameStateManager = gameStateManager; World = world; GameStateManager.StateChanged += GameStateManager_StateChanged; Console.WriteLine("GameScene constructed."); }
public void GetHighestCompletedLevelAttemptForPlayer_NoneTried() { //Arrange Level level1 = GetTestLevel(); Player player = GetTestPlayer(); LevelProvider provider = new LevelProvider(_context); //Act LevelAttempt attempt = provider.GetHighestCompletedLevelAttemptForPlayer(player.Id); //Assert Assert.AreEqual(null, attempt); }
public void GetNextNonCompleteLevel_OneLevelCompleted() { //Arrange Level level1 = GetTestLevel(); Level level2 = GetTestLevel(sequenceInWorld: 2); Level level3 = GetTestLevel(sequenceInWorld: 3); Player player = GetTestPlayer(); LevelAttempt savedAttempt = GetTestLevelAttempt(player.Id, level1.Id, completed: true); LevelProvider provider = new LevelProvider(_context); //Act Level nextLevel = provider.GetNextNonCompleteLevel(player.Id); //Assert Assert.AreEqual(level2.Id, nextLevel.Id); }
public void GetHighestCompletedLevelAttemptForPlayer_OneCompletedSecondNotTried() { //Arrange Level level1 = GetTestLevel(); Level level2 = GetTestLevel(sequenceInWorld: 2); Level level3 = GetTestLevel(sequenceInWorld: 3); Player player = GetTestPlayer(); LevelAttempt savedAttempt = GetTestLevelAttempt(player.Id, level1.Id, completed: true); LevelProvider provider = new LevelProvider(_context); //Act LevelAttempt attempt = provider.GetHighestCompletedLevelAttemptForPlayer(player.Id); //Assert Assert.AreEqual(savedAttempt.Id, attempt.Id); }
public void Init(int ownerId) { Id = ownerId; StatsManager.Init(Id, 0, _dbMob.Dex, 0, 0, _dbMob.Wis, _dbMob.Luc, def: _dbMob.Defense, res: _dbMob.Magic); LevelProvider.Init(Id, _dbMob.Level); HealthManager.Init(Id, _dbMob.HP, _dbMob.MP, _dbMob.SP, _dbMob.HP, _dbMob.MP, _dbMob.SP); BuffsManager.Init(Id); CountryProvider.Init(Id, _dbMob.Fraction); SpeedManager.Init(Id); AttackManager.Init(Id); SkillsManager.Init(Id, new Skill[0]); var x = new Random().NextFloat(_moveArea.X1, _moveArea.X2); var y = new Random().NextFloat(_moveArea.Y1, _moveArea.Y2); var z = new Random().NextFloat(_moveArea.Z1, _moveArea.Z2); MovementManager.Init(Id, x, y, z, 0, MoveMotion.Walk); AIManager.Init(Id, _dbMob.AI, _moveArea, idleTime: _dbMob.NormalTime <= 0 ? 4000 : _dbMob.NormalTime, idleSpeed: _dbMob.NormalStep, chaseRange: _dbMob.ChaseRange, chaseSpeed: _dbMob.ChaseStep, chaseTime: _dbMob.ChaseTime, isAttack1Enabled: _dbMob.AttackOk1 != 0, isAttack2Enabled: _dbMob.AttackOk2 != 0, isAttack3Enabled: _dbMob.AttackOk3 != 0, attack1Range: _dbMob.AttackRange1, attack2Range: _dbMob.AttackRange2, attack3Range: _dbMob.AttackRange3, attackType1: _dbMob.AttackType1, attackType2: _dbMob.AttackType2, attackType3: _dbMob.AttackType3, attackAttrib1: _dbMob.AttackAttrib1, attackAttrib2: _dbMob.AttackAttrib2, attack1: _dbMob.Attack1 < 0 ? (ushort)(_dbMob.Attack1 + ushort.MaxValue) : (ushort)_dbMob.Attack1, attack2: _dbMob.Attack2 < 0 ? (ushort)(_dbMob.Attack2 + ushort.MaxValue) : (ushort)_dbMob.Attack2, attack3: _dbMob.Attack3 < 0 ? (ushort)(_dbMob.Attack3 + ushort.MaxValue) : (ushort)_dbMob.Attack3, attackTime1: _dbMob.AttackTime1, attackTime2: _dbMob.AttackTime2, attackTime3: _dbMob.AttackTime3); }
public void GetOrderedLevels_MultipleLevelsInTwoWorlds() { //Arrange Level level1 = GetTestLevel(10000, 2); Level level2 = GetTestLevel(); Level level3 = GetTestLevel(10000); LevelProvider provider = new LevelProvider(_context); //Act List <Level> levels = provider.GetOrderedLevels().ToList(); //Assert int level1Index = levels.FindIndex(l => l.Id == level1.Id); int level2Index = levels.FindIndex(l => l.Id == level2.Id); int level3Index = levels.FindIndex(l => l.Id == level3.Id); Assert.IsTrue(level1Index > level2Index && level1Index > level3Index && level2Index < level3Index); }
protected override List <System_Level> ReadDB(string connectionString) { return(LevelProvider.DownloadDB(connectionString)); }
public override bool Reset(string connectionString) { return(LevelProvider.UpdateDB(this.XmlReadData, connectionString)); }
public override bool Init(string connectionString) { return(LevelProvider.InitDB(this.XmlReadData, connectionString)); }