public void Execute() { if (firstEntity is StarMario) { secondEntity.PopOff(); SoundFactory.Instance.PlaySoundEffect("SOUND_KICK"); int score = ScoreKeeper.Instance.IncreaseScore(); PlayerLevel.Instance.ScoreArray.Add(ScoreFactory.CreateScore(score, secondEntity.Location)); } if (secondEntity.ConditionState is EnemyDefeatedState) { IPhysics secondEntityPhysics = (IPhysics)secondEntity; if (secondEntityPhysics.Velocity.X == 0) { SoundFactory.Instance.PlaySoundEffect("SOUND_KICK"); secondEntity.RunRight(); secondEntityPhysics.Velocity = new Vector2((float)2.5, secondEntityPhysics.Velocity.Y); } else if (secondEntityPhysics.Velocity.X < 0) { firstEntity.TakeDamage(); } } else { firstEntity.TakeDamage(); } }
public void Execute() { int score = ScoreKeeper.Instance.IncreaseScore(); PlayerLevel.Instance.ScoreArray.Add(ScoreFactory.CreateScore(score, secondEntity.Location)); ScoreKeeper.Instance.IncMultiplier(); if (firstEntity is StarMario) { secondEntity.PopOff(); SoundFactory.Instance.PlaySoundEffect("SOUND_KICK"); int scoreDisp = ScoreKeeper.Instance.IncreaseScore(); PlayerLevel.Instance.ScoreArray.Add(ScoreFactory.CreateScore(scoreDisp, secondEntity.Location)); } firstEntity.Location = new Vector2(firstEntity.Location.X, firstEntity.Location.Y - collision.Overlap.Height); firstEntity.MovementState = new MarioRightJumpState(firstEntity); IPhysics secondEntityPhysics = (IPhysics)secondEntity; if (secondEntityPhysics.Velocity.X != 0) { secondEntityPhysics.Velocity = new Vector2(0, 0); SoundFactory.Instance.PlaySoundEffect("SOUND_STOMP"); } else { secondEntityPhysics.Velocity = new Vector2(SHELLSPEED, 0); SoundFactory.Instance.PlaySoundEffect("SOUND_STOMP"); } secondEntity.RunLeft(); secondEntity.TakeDamage(); }
public void CreateNewScore_EmptyModel_ReturnsErrorModel() { var testClass = ServiceFactory.Create_ScoreService(); var testModel = ScoreFactory.Create_CreateScoreDomainModel_Empty(); Should.Throw <MissingInfoException>(() => testClass.CreateNewScore(testModel)); }
private void LoadScore(string filePath) { { BinaryFormatter bf = new BinaryFormatter(); using (Stream iStream = new FileStream (ofdScoreFile.FileName, FileMode.Open, FileAccess.Read)) score = (Score)bf.Deserialize(iStream); // Adjust old style note classes List <IMeasure> newMeasures = new List <IMeasure>(); ScoreFactory sf = new ScoreFactory(); foreach (IMeasure m in score.Measures) { for (int i = 0; i < m.Notes.Count(); i++) { if (!(m.Notes[i] is ColouredNote)) { m.Notes[i] = sf.CreateNote (m.Notes[i].Offset, m.Notes[i].Pitch, m.Notes[i].Duration); } } } filePath = ofdScoreFile.FileName; Properties.Settings.Default.FilePath = filePath; Properties.Settings.Default.Save(); LoadImages(); } }
public void CreateScore_EmptyEntity_ThrowsMissingInfoException() { var testClass = InteractorFactory.Create_ScoreInteractor(); var emptyScore = ScoreFactory.Create_ScoreEntity_Empty(); Should.Throw <MissingInfoException>(() => testClass.CreateScore(emptyScore)); }
public void UpdateScore_NewObject_ThrowsObjectNotFound() { var testClass = InteractorFactory.Create_ScoreInteractor(); var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); Should.Throw <ObjectNotFoundException>(() => testClass.UpdateScore(testScore)); }
public void Execute() { firstEntity.CreateStarMario(); int score = ScoreKeeper.Instance.IncreaseCustomScore(1000); SuperPixelBrosGame.Level.PlayerLevel.Instance.ScoreArray.Add(ScoreFactory.CreateScore(score, secondEntity.Location)); SuperPixelBrosGame.Level.PlayerLevel.Instance.ItemArray.Remove(secondEntity); }
/// <summary> /// スコアー初期化 /// </summary> /// <returns></returns> public IScore InitScore(int EndGameScore) { CacheScore = ScoreFactory.Create(0, EndGameScore); IsCreated = true; return(CacheScore); }
public ScoreEntity GetScore(Guid scoreId) { if (scoreId.Equals(Guid.Empty)) { throw new ObjectNotFoundException(); } return(ScoreFactory.Create_ScoreEntity_ValidMinimum(scoreId)); }
internal override void Initialize() { InputManager.ReplayScore = autoScore = ScoreFactory.Create(Player.Mode, "osu!", player.hitObjectManager.Beatmap); player.Ruleset.CreateAutoplayReplay(); Player.currentScore.InvalidateSubmission(); //This mode is totally unranked. base.Initialize(); }
public void Test_without_calcule_FamilyAgeApplicantScore() { var TOTAL_SCORE = 0; var score = ScoreFactory.CreateScoreRule <FamilyAgeApplicantScore>(TestFamily); Assert.Equal(TOTAL_SCORE, score.Score); Assert.False(score.IsClassified); }
public void CreateScore_MinimumEntity_ReturnsNewGuid() { var testClass = InteractorFactory.Create_ScoreInteractor(); var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); var result = testClass.CreateScore(testScore); result.ShouldNotBe(Guid.Empty); }
public void CreateNewScore_ValidMin_ReturnsGoodName() { var testClass = ServiceFactory.Create_ScoreService(); var testModel = ScoreFactory.Create_CreateScoreDomainModel_ValidMinimum(); var result = testClass.CreateNewScore(testModel); result.Name.ShouldNotBe(string.Empty); }
public void Execute() { secondEntity.PopOff(); SoundFactory.Instance.PlaySoundEffect("SOUND_KICK"); int score = ScoreKeeper.Instance.IncreaseScore(); PlayerLevel.Instance.ScoreArray.Add(ScoreFactory.CreateScore(score, secondEntity.Location)); PlayerLevel.Instance.DespawnList.Add((ICollidable)firstEntity); }
public void UpdateScore_ValidModel_ReturnsValidModel() { var testScoreEntity = ScoreFactory.Create_ScoreEntity_ValidMinimum(Guid.NewGuid()); var testScore = new ScoreDomainModel(testScoreEntity); var testClass = ServiceFactory.Create_ScoreService(); var result = testClass.UpdateScore(testScore); result.GetType().ShouldNotBe(typeof(ErrorDomainModel)); }
public void CreateNewScore_ValidMin_Returns80Percent() { var testClass = ServiceFactory.Create_ScoreService(); var testModel = ScoreFactory.Create_CreateScoreDomainModel_80Percent(); var result = testClass.CreateNewScore(testModel); var castedResult = (ScoreDomainModel)result; castedResult.PointsGrade.ShouldBe(.8); }
public void CreateScore_DuplicateEntry_ThrowsObjectAlreadyExists() { var testRepo = new MockRepository <ScoreEntity>(); var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); var testGuid = testRepo.Create(testScore); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var duplicateScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); Should.Throw <ObjectAlreadyExistsException>(() => testClass.CreateScore(duplicateScore)); }
public IEnumerable <Score> GetHighScoresForAllPlayers(DateTime startDate, DateTime endDate) { GetHighScoresForAllPlayersResult dbResult = _gameRepository.GetHighScoresForAllPlayers(ROUNDS_PER_GAME, startDate, endDate); // One extra database round trip to get all user names... on second thought, this should've been in the USP Dictionary <int, UserEntity> userIds = _userRepository.GetAll(dbResult.Results.Select(r => r.UserId)); return(dbResult.Results .Select(r => ScoreFactory.Create(r, userIds)) .OrderBy(x => x.AmountOfCorrectAnswers) .ThenBy(x => x.Duration).ToList()); }
public void Test_calcule_FamilyIncomeScore_ok() { var TOTAL_SCORE = 5; var score = ScoreFactory.CreateScoreRule <FamilyIncomeScore>(TestFamily); score.CalculateScore(); Assert.Equal(TOTAL_SCORE, score.Score); Assert.True(score.IsClassified); }
public void GetScoresByEvalId_DiffGuidExistingScores_ReturnsZero() { var testGuid = Guid.NewGuid(); var testScores = ScoreFactory.Create_ListOfScoreEntity(testGuid); var testRepo = new MockRepository <ScoreEntity>(testScores); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var result = testClass.GetScoresByEvaluationId(Guid.NewGuid()); result.Count.ShouldBe(0); }
public void GetScore_ValidGuid_GetsValidModel() { var testRepo = new MockRepository <ScoreEntity>(); var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); var testGuid = testRepo.Create(testScore); var testClass = ServiceFactory.Create_ScoreService(); var result = testClass.GetScore(testGuid); result.Name.ShouldNotBe(string.Empty); }
void OnTriggerEnter(Collider other) { if (other.tag != "Boundary") { Destroy(gameObject); if (other.tag == "Bolt") { ScoreFactory.GetScore().AddScore(); } } }
public void scoreQuestion(TimeSpan time, Question newQuestion, long answer) { questions.Add(newQuestion); if (answer.Equals("?")) { //user didn't answer answers.Add(ScoreFactory.NoAnswer()); } else { answers.Add(ScoreFactory.Answer(time, newQuestion.verify(answer))); } }
public void GetScoresByEvalId_ExistingScores_ReturnsThree() { var testGuid = Guid.NewGuid(); var testScores = ScoreFactory.Create_ListOfScoreEntity(testGuid); var testRepo = new MockRepository <ScoreEntity>(testScores); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var result = testClass.GetScoresByEvaluationId(testGuid); var allGradeResults = result.All(s => s.PointsGrade == .8); result.Count.ShouldBe(3); allGradeResults.ShouldBe(true); }
public void DeleteScore_ValidGuid_RemovesScore() { var evalGuid = Guid.NewGuid(); var testList = ScoreFactory.Create_ListOfScoreEntity(evalGuid); var testRepo = new MockRepository <ScoreEntity>(testList); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var testGuid = testRepo.GetAll().First().Id; testClass.DeleteScore(testGuid); var result = testClass.GetScoresByEvaluationId(evalGuid); result.Count.ShouldBe(2); }
public void Execute() { int score = ScoreKeeper.Instance.IncreaseScore(); SuperPixelBrosGame.Level.PlayerLevel.Instance.ScoreArray.Add(ScoreFactory.CreateScore(score, secondEntity.Location)); SuperPixelBrosGame.Level.PlayerLevel.Instance.ItemArray.Remove(secondEntity); if (secondEntity is Coin) { ScoreKeeper.Instance.IncrementCoins(); SoundFactory.Instance.PlaySoundEffect("SOUND_COIN"); } else if (secondEntity is OneUpMushroom) { SoundFactory.Instance.PlaySoundEffect("SOUND_1UP"); } }
public void GetScore_ExistingScore_ReturnsScore() { var testRepo = new MockRepository <ScoreEntity>(); var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); var testGuid = testRepo.Create(testScore); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var result = testClass.GetScore(testGuid); result.Name.ShouldNotBe(string.Empty); result.Id.ShouldBe(testGuid); result.PointsGrade.ShouldBe(.8); result.PointsEarned.ShouldBe(8); result.PointsPossible.ShouldBe(10); }
public void CreateOddBarScore() { ScoreFactory sf = new ScoreFactory(); IScore score = sf.CreateScore(); score.Measures.Add(sf.CreateMeasure(4, false)); score.Measures.Add(sf.CreateMeasure(3, false)); score.Measures.Add(sf.CreateMeasure(4, false)); score.Measures.Add(sf.CreateMeasure(3, false)); score.Measures.Add(sf.CreateMeasure(3, false)); score.Measures.Add(sf.CreateMeasure(4, false)); ScoreWriter sw = new ScoreWriter(score, 6); Image img = sw.RenderPage(0); img.Save("c:\\tmp\\varBarScore.bmp"); Assert.IsNotNull(img); }
public void CreateScoreWithFlats() { ScoreFactory sf = new ScoreFactory(); IScore score = sf.CreateScore(true); score.Measures.Add(sf.CreateMeasure(4, false)); score.Measures.Add(sf.CreateMeasure(3, false)); score.Measures[0].Notes.Add(sf.CreateNote(0, 13, 4)); score.Measures[0].Notes.Add(sf.CreateNote(2, 14, 4)); score.Measures[0].Notes.Add(sf.CreateNote(4, 15, 4)); score.Measures[0].Notes.Add(sf.CreateNote(14, 39, 4)); score.Measures[0].Notes.Add(sf.CreateNote(14, 40, 4)); score.Measures[1].Notes.Add(sf.CreateNote(0, 42, 4)); ScoreWriter sw = new ScoreWriter(score, 6); Image img = sw.RenderPage(0); img.Save("c:\\tmp\\flatScore.bmp"); Assert.IsNotNull(img); }
public void UpdateScore_ValidObject_UpdatesScore() { var evalGuid = Guid.NewGuid(); var testList = ScoreFactory.Create_ListOfScoreEntity(evalGuid); var testRepo = new MockRepository <ScoreEntity>(testList); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var scoreToUpdate = testRepo.GetAll().First(); var updatedScore = new ScoreEntity { Id = scoreToUpdate.Id, PointsPossible = 5, PointsEarned = 4, PointsGrade = .8 }; testClass.UpdateScore(updatedScore); var result = testClass.GetScore(scoreToUpdate.Id); result.LastModified.ShouldNotBeSameAs(scoreToUpdate.LastModified); result.PointsEarned.ShouldBe(4); result.PointsPossible.ShouldBe(5); result.PointsGrade.ShouldBe(.8); }