public void a_CorrectPiece_cannot_be_reevaluated_by_a_Subset_feedback_generator_if_it_is_ouside_of_its_scope() { Puzzle puzzle = createPuzzle(new List <string> { "One-White", "One-White", "Two-White", "Two-White", "Three-White", "Three-White" }); FeedbackGenerator sut = new FeedbackGenerator(puzzle, new List <int> { 1, 2, 3, 4 }); Guess guess = createGuess(new List <string> { "Four-White", "Four-White", "Four-White", "Three-White", "Three-White", "Three-White" }); var actualFeedback = sut.Calculate(guess); Assert.AreEqual(1, actualFeedback.CorrectPieces); }
public void OnDamage(Shooter p_damager, DamageType p_type, int p_damage, bool p_bypassDefense, bool p_bypassImmunityWindow) { int finalDamage = p_damage; int effective = p_type.IsEffectiveAgainst(m_type); if (!p_bypassDefense) { finalDamage -= m_defense; } if (effective == 1) { finalDamage = Mathf.CeilToInt(finalDamage * 1.5f); } else if (effective == -1) { finalDamage /= 2; } if (m_feedbackTemplate && (!m_health.IsImmune() || p_bypassImmunityWindow)) { FeedbackGenerator.GenerateFeedback(transform, m_feedbackTemplate, p_type, finalDamage <= 0 ? 0 : -finalDamage, Constants.YELLOW, p_bypassDefense ? Constants.PURPLE : Constants.TRANSPARENT, m_feedbackPositionRandomness.x, m_feedbackPositionRandomness.y); } if (finalDamage > 0) { m_health.Damage(finalDamage, p_bypassImmunityWindow); } }
public void A_guess_piece_is_Similar_when_it_has_same_symbol_as_its_corresponding_puzzle_piece_but_with_different_color() { Puzzle puzzle = createPuzzle(new List <string> { "One-Black" }); Guess guess = createGuess(new List <string> { "One-White" }); FeedbackGenerator sut = new FeedbackGenerator(puzzle, new List <int> { 0 }); var actualFeedback = sut.Calculate(guess); Assert.AreEqual(0, actualFeedback.CorrectPieces); Assert.AreEqual(1, actualFeedback.SimilarPieces); }
public void Calculate_throws_exception_if_guess_count_not_match_puzzle_count() { int puzzleCount = 4; FeedbackGenerator sut_1 = new FeedbackGenerator(new Puzzle(puzzleCount), new List <int>()); var nonMatchingGuessCount_lower_1 = new Guess(puzzleCount - 1); var nonMatchingGuessCount_higher_1 = new Guess(puzzleCount + 1); Assert.Throws <InvalidOperationException>(() => sut_1.Calculate(nonMatchingGuessCount_lower_1)); Assert.Throws <InvalidOperationException>(() => sut_1.Calculate(nonMatchingGuessCount_higher_1)); OverallFeedbackGenerator sut_2 = new OverallFeedbackGenerator(new Puzzle(puzzleCount)); var nonMatchingGuessCount_lower_2 = new Guess(puzzleCount - 1); var nonMatchingGuessCount_higher_2 = new Guess(puzzleCount + 1); Assert.Throws <InvalidOperationException>(() => sut_2.Calculate(nonMatchingGuessCount_lower_2)); Assert.Throws <InvalidOperationException>(() => sut_2.Calculate(nonMatchingGuessCount_higher_2)); }
public static void Main(string[] args) { var host = CreateWebHostBuilder(args).Build(); //2. Find the service layer within our scope. using (var scope = host.Services.CreateScope()) { //3. Get the instance of BoardGamesDBContext in our services layer var services = scope.ServiceProvider; var context = services.GetRequiredService <FeedbackContext>(); //4. Call the DataGenerator to create sample data FeedbackGenerator.Initialize(services); } //Continue to run the application host.Run(); }
public void OnDamage(Shooter p_damager, DamageType p_type, int p_damage, bool p_bypassDefense, bool p_bypassImmunityWindow) { if (m_health) { int finalDamage = p_damage; int effective = p_type.IsEffectiveAgainst(m_type); if (!p_bypassDefense) { finalDamage -= m_stats.GetStatEffect(Stats.DEF); } if (effective == 1) { finalDamage = Mathf.CeilToInt(finalDamage * 1.5f); } else if (effective == -1) { finalDamage /= 2; } int resistance = Mathf.FloorToInt(m_modifiers.GetModifier(p_type.m_name + " Resistance")); finalDamage -= resistance; if (m_feedbackTemplate && (!m_health.IsImmune() || p_bypassImmunityWindow)) { FeedbackGenerator.GenerateFeedback(transform, m_feedbackTemplate, p_type, finalDamage <= 0 ? 0 : -finalDamage, m_feedbackColor, p_bypassDefense ? Constants.PURPLE : Constants.TRANSPARENT, m_feedbackPositionRandomness.x, m_feedbackPositionRandomness.y); } if (finalDamage > 0) { m_health.Damage(finalDamage, p_bypassImmunityWindow); } } // make sure the AI starts targeting its last damager (if it's an entity) if (m_ai && p_damager && p_damager.m_entity) { m_ai.m_target = p_damager.m_entity; } }
// Init the classes and the differents gameObjects private void Start() { Debug.Log("Entramos en controlador Partida"); menuPausa = GameObject.Find("Canvas"); UIController = this.GetComponentInParent <controladorMenus>(); //controladorMenus.menuIniciDeDia(dia_actual); feedbackGenerator = new FeedbackGenerator(); orderGenerator = new ComandaContChef(); cardinalitatyController = new ControlCardinalitats(); achievementsController = new AchievementsController(); subject.AddObserver(achievementsController); this.userControl = GameObject.Find("UserControl").GetComponent <UserController>(); this.lettuceGenerator = GameObject.Find("lettuce_generator"); this.lettuceGenerator.SetActive(false); this.actualDay = this.userControl.getCurrentDay(); this.totalExp = this.userControl.getTotalExp(); GameObject.Find("MusicController").GetComponent <musicController>().setVolume(this.userControl.getVolume()); }
// Inicializamos todas las clases y los diferentes gameobjects que tengamos. private void Start() { menuPausa = GameObject.Find("Canvas"); UIController = this.GetComponentInParent <ControllerMenuTutorial>(); //controladorMenus.menuIniciDeDia(dia_actual); feedbackGenerator = new FeedbackGenerator(); orderGenerator = new ComandaContChef(); controlCardinalities = new ControlCardinalitats(); soundControl = GameObject.Find("ControllerSonidos").GetComponent <ControllerSonidos>(); achievementsController = new AchievementsController(); subject.AddObserver(achievementsController); this.userControl = GameObject.Find("UserControl").GetComponent <UserController>(); this.lettuceGenerator = GameObject.Find("lettuce_generator"); this.lettuceGenerator.SetActive(false); this.actualDay = this.userControl.getCurrentDay(); this.totalExp = this.userControl.getTotalExp(); this.isNextStateBlocked = false; this.isGeneratoringGrabbed = false; this.controlCardinalities.generateCardinalities(); }