Ejemplo n.º 1
0
        void Awake()
        {
            GameNarrativeManager narrativeManager = FindObjectOfType <GameNarrativeManager>();
            MonsterFactory       monsterFactory   = FindObjectOfType <MonsterFactory>();

            try
            {
                Guid   monster     = narrativeManager.CurrentStage.MonsterID;
                string monsterName = monsterFactory.LoadMonster(monster).Name;

                if (monsterName == NessieName)
                {
                    SetNessie();
                }
                else if (monsterName == CerberusName)
                {
                    SetCerberus();
                }
                else if (monsterName == RedactedName)
                {
                    SetRedacted();
                }
                else
                {
                    Debug.LogWarning("Unexpected value -- Defaulting to Nessie");
                    SetNessie();
                }
            }
            catch
            {
                Debug.LogWarning("Dialogue not running in scene -- Defaulting to Nessie");
                SetNessie();
            }
        }
        IEnumerator ShowX()
        {
            SFX.playForIncorrectIngredient();
            MonsterFactory       monsterFactory   = FindObjectOfType <MonsterFactory>();
            GameNarrativeManager narrativeManager = FindObjectOfType <GameNarrativeManager>();

            try
            {
                var monsterData = monsterFactory.LoadMonster(narrativeManager.CurrentStage.MonsterID);
                monsterData.UpdateAffectionFromIngredientSelection(Type);

                if (monsterData.AffectionValue <= monsterData.FightThreshold)
                {
                    var combatInitiator = FindObjectOfType <CombatInitiator>();
                    combatInitiator.InitiateCombat(narrativeManager.CurrentStage.MonsterID, 1 - monsterData.AffectionValue);
                }
            }
            catch (Exception)
            {
                Debug.LogWarning("Scene Not Running in Game");
            }

            IncorrectMarker.SetActive(true);
            yield return(new WaitForSeconds(1));

            IncorrectMarker.SetActive(false);
        }
Ejemplo n.º 3
0
        // Use this for initialization
        void Start()
        {
            Tutorial.alpha = 1;
            Tutorial.gameObject.SetActive(true);

            FinalScore.alpha = 0;
            FinalScore.gameObject.SetActive(false);

            TutorialButton.onClick.AddListener(() => StartCoroutine(StartGame()));

            FinalScoreButton.onClick.AddListener(() =>
            {
                try
                {
                    DishPreparationManager dishPreparation = FindObjectOfType <DishPreparationManager>();
                    GameNarrativeManager narrativeManager  = FindObjectOfType <GameNarrativeManager>();
                    MonsterFactory monsterFactory          = FindObjectOfType <MonsterFactory>();

                    MonsterData data = monsterFactory.LoadMonster(narrativeManager.CurrentStage.MonsterID);
                    dishPreparation.StartPreparingDish(
                        narrativeManager.CurrentStage.MonsterID,
                        data.DesiredIngredients
                        );
                    dishPreparation.GoToNextScene();
                }
                catch (Exception ex)
                {
                    Debug.Log(ex.Message);
                    Debug.Log("Shaking Not Running in Game");
                }
            });
        }
Ejemplo n.º 4
0
        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();
        }
        // Use this for initialization
        void Awake()
        {
            Group.gameObject.SetActive(false);
            PurpleStuff.gameObject.SetActive(false);

            Nessie.gameObject.SetActive(false);
            Cerberus.gameObject.SetActive(false);
            Redacted.gameObject.SetActive(false);

            if (GameObject.Find("GameData") == null)
            {
                _MonsterFactory = gameObject.AddComponent(typeof(MonsterFactory)) as MonsterFactory;

                GameNarrativeManager gameNarrativeManager = gameObject.AddComponent <GameNarrativeManager>();
                gameNarrativeManager.Start();
                while (gameNarrativeManager.AnyStagesLeft())
                {
                    gameNarrativeManager.StartNextStage();
                    gameNarrativeManager.DateableMonsterIDs.Add(gameNarrativeManager.CurrentStage.MonsterID);
                }
                gameNarrativeManager.DateableMonsterIDs.Remove(gameNarrativeManager.DateableMonsterIDs[0]);
            }
            else
            {
                _MonsterFactory = GameObject.FindObjectOfType <MonsterFactory>();
                var GameSettings = GameObject.FindObjectOfType <GameSettings>();
                InitialMusic.volume = GameSettings.MusicVolume * GameSettings.MasterVolume;
                FinalMusic.volume   = GameSettings.MusicVolume * GameSettings.MasterVolume;

                Phone.volume = GameSettings.SfxVolume * GameSettings.MasterVolume;
            }

            CreateChoiceButtons();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Starts and displays the dialogue for each sentence in the list of sentences
        /// </summary>
        /// <param name="monsterId">The ID of the monster to start a dialogue with</param>
        public void StartDialogue(Guid monsterId)
        {
            var monsterFactory = GameObject.FindObjectOfType <MonsterFactory>();

            if (monsterFactory == null)
            {
                throw new Exception("MonsterFactory did not exist in scene");
            }

            _GameNarrativeManager = GameObject.FindObjectOfType <GameNarrativeManager>();
            if (_GameNarrativeManager == null)
            {
                throw new Exception("GameNarrativeManager did not exist in scene");
            }

            _GameSettings = GameObject.FindObjectOfType <GameSettings>();
            if (_GameSettings == null)
            {
                throw new Exception("GameSettings did not exist in scene");
            }

            _MonsterData       = monsterFactory.LoadMonster(monsterId);
            _DialogDataManager = DialogDataManager.LoadFromXml(monsterId);
            _CurrentPrompt     = _DialogDataManager.Prompts[_DialogDataManager.InitialPromptID];

            DisplayPromptBody();
        }
Ejemplo n.º 7
0
    /// <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;
    }
Ejemplo n.º 8
0
 void Awake()
 {
     _CombatInitiator      = GameObject.FindObjectOfType <CombatInitiator>();
     _GameNarrativeManager = GameObject.FindObjectOfType <GameNarrativeManager>();
     _MonsterFactory       = GameObject.FindObjectOfType <MonsterFactory>();
     _AreItemsLoaded       = true;
 }
Ejemplo n.º 9
0
 void Awake()
 {
     if (Instance != null)
     {
         Destroy(this);
     }
     Instance = this;
 }
Ejemplo n.º 10
0
        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");
            }
        }
Ejemplo n.º 11
0
        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));
        }
Ejemplo n.º 12
0
        void Awake()
        {
            GameActive  = false;
            Ingredients = new List <IngredientController>(FindObjectsOfType <IngredientController>());

            MonsterFactory       monsterFactory   = FindObjectOfType <MonsterFactory>();
            GameNarrativeManager narrativeManager = FindObjectOfType <GameNarrativeManager>();

            uint numPlates;
            List <IngredientType> ingredientTypes;

            try
            {
                Guid monsterID = narrativeManager.CurrentStage.MonsterID;
                MonsterData = monsterFactory.LoadMonster(monsterID);

                numPlates       = (uint)MonsterData.DesiredIngredients.Count;
                ingredientTypes = MonsterData.DesiredIngredients;
            }
            catch (Exception)
            {
                Debug.LogWarning("Could not load persistent objects -- Defaulting to shake");
                numPlates = 3;

                ingredientTypes = new List <IngredientType>
                {
                    IngredientType.AlgaeSlime, IngredientType.IceCream, IngredientType.AquariumGravel
                };
            }

            Plates = SetPlates(numPlates, Space);

            Ingredients.ForEach((ingredient) =>
            {
                IngredientType type = ingredient.Type;
                ingredient.InRecipe = ingredientTypes.Contains(type);
                ingredient.Plates   = Plates;
            });
        }
Ejemplo n.º 13
0
        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;
        }
Ejemplo n.º 14
0
        /// <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";
        }