public void EndGame() { ShakerLabel.text = ShakerFinal; float score = GetScore(); Debug.Log(score); FinalScoreText.text = GetScoreText(score); try { DishPreparationManager preparationManager = FindObjectOfType <DishPreparationManager>(); GameNarrativeManager narrativeManager = FindObjectOfType <GameNarrativeManager>(); DishScoreManager scoreManager = FindObjectOfType <DishScoreManager>(); Guid monsterID = narrativeManager.CurrentStage.MonsterID; IngredientType currentIngredient = preparationManager.currentIngredient; scoreManager.AddIngredientToDish(monsterID, currentIngredient, score); } catch (Exception ex) { Debug.Log(ex.Message); Debug.Log("Shaking Scene not Running in Game"); } UIManager.EndGame(); }
/// <summary> /// Just runs because Unity components /// </summary> void Start() { _CombatInitiator = GetComponent <CombatInitiator>(); if (_CombatInitiator == null) { throw new Exception("CombatInitiator does not exist on object"); } _DishScoreManager = GetComponent <DishScoreManager>(); if (_DishScoreManager == null) { throw new Exception("DishScoreManager does not exist on object"); } _GameNarrativeManager = GetComponent <GameNarrativeManager>(); if (_GameNarrativeManager == null) { throw new Exception("GameNarrativeManager does not exist on object"); } _MonsterFactory = GetComponent <MonsterFactory>(); if (_MonsterFactory == null) { throw new Exception("MonsterFactory does not exist on object"); } _IngredientsQueue = null; }
public void ScoreGame() { CalculateScore(); SetScore(); try { DishPreparationManager preparationManager = FindObjectOfType <DishPreparationManager>(); GameNarrativeManager narrativeManager = FindObjectOfType <GameNarrativeManager>(); DishScoreManager scoreManager = FindObjectOfType <DishScoreManager>(); Guid monsterID = narrativeManager.CurrentStage.MonsterID; IngredientType currentIngredient = preparationManager.currentIngredient; scoreManager.AddIngredientToDish(monsterID, currentIngredient, Score); } catch (Exception ex) { Debug.Log(ex.Message); Debug.Log("Shaking Scene not Running in Game"); } }
public void EndGame() { Score = CalculateScore(); try { DishPreparationManager preparationManager = FindObjectOfType <DishPreparationManager>(); GameNarrativeManager narrativeManager = FindObjectOfType <GameNarrativeManager>(); DishScoreManager scoreManager = FindObjectOfType <DishScoreManager>(); Guid monsterID = narrativeManager.CurrentStage.MonsterID; IngredientType currentIngredient = preparationManager.currentIngredient; scoreManager.AddIngredientToDish(monsterID, currentIngredient, Score); } catch (Exception ex) { Debug.Log(ex.Message); Debug.Log("Grill Scene not Running in Game"); } StartCoroutine(Manager.ShowScore(Score)); }
public void SetScore() { CalculateScore(); try { DishPreparationManager preparationManager = FindObjectOfType <DishPreparationManager>(); GameNarrativeManager narrativeManager = FindObjectOfType <GameNarrativeManager>(); DishScoreManager scoreManager = FindObjectOfType <DishScoreManager>(); Guid monsterID = narrativeManager.CurrentStage.MonsterID; IngredientType currentIngredient = preparationManager.currentIngredient; scoreManager.AddIngredientToDish(monsterID, currentIngredient, Score); } catch (Exception ex) { Debug.Log(ex.Message); Debug.Log("Microwave Scene not Running in Game"); } int displayScore = Mathf.RoundToInt((1f - Score) * 1000f); string displayMessage = displayScore.ToString() + "/1000"; ScoreText.text = displayMessage; }
/// <summary> /// Ends this minigame by setting each of the different components to their finished /// state. /// </summary> public void EndGame() { CalculateScore(); try { DishPreparationManager preparationManager = FindObjectOfType <DishPreparationManager>(); GameNarrativeManager narrativeManager = FindObjectOfType <GameNarrativeManager>(); DishScoreManager scoreManager = FindObjectOfType <DishScoreManager>(); Guid monsterID = narrativeManager.CurrentStage.MonsterID; IngredientType currentIngredient = preparationManager.currentIngredient; scoreManager.AddIngredientToDish(monsterID, currentIngredient, Score); } catch (Exception ex) { Debug.Log(ex.Message); Debug.Log("Chopping Scene not Running in Game"); } float scaledScore = (1 - Score) * 1000; FinalScore.text = Mathf.RoundToInt(scaledScore).ToString() + "/1000"; }