//Sets everything necessary back to their starting values void ResetKitchen() { minigamesComplete = 0; ingredientSpawner.SelectDish(); //ingredientSpawner.SelectDish("HandSpongeRat"); //sets up stations for not first time use GetStations(false); //creates a new dish item object and deactivates it for now completeDish = Instantiate <GameObject>(dishObject); completeDish.GetComponent <Item>().Type = MenuScript.IngredientType.dish; completeDish.SetActive(false); //deactivates the cover cover.SetActive(false); //makes sure state is playing again state = stateEnum.playing; isScenePaused = false; //start with ticket active ticketObject.SetActive(true); SetupTicket(); if (FindObjectsOfType(GetType()).Length > 1) { Destroy(gameObject); } //list to hold ingredients ingredientObjects = new List <GameObject>(); foreach (GameObject g in GameObject.FindGameObjectsWithTag("Holdable")) { ingredientObjects.Add(g); } SetIngredientsGlow(true); }
// Use this for initialization void Start() { //Finds pause button in the scene by its tag pauseButton = GameObject.FindGameObjectWithTag("PauseButton"); // 0 games completed on startup minigamesComplete = 0; //Finds the main camera sceneCam = GameObject.FindGameObjectWithTag("MainCamera"); //Sets up tiles, stations and other objects kitchen = GetComponent <SetupKitchen>(); kitchen.Initialize(); //Spawns a player object player = Instantiate <GameObject>(playerObject); //Gets player script playerScript = player.GetComponent <PlayerScript>(); //Set ingredientspawner object as an instantiated copy and gets its script ingSpawnerObject = Instantiate <GameObject>(ingSpawnerObjectPublic); ingredientSpawner = ingSpawnerObject.GetComponent <IngredientSpawner>(); //Set messSpawner object as an instantiated copy and gets its script messSpawnerObject = Instantiate <GameObject>(messSpawnerObjectPublic); messSpawner = messSpawnerObject.GetComponent <messScript>(); //Chooses a dish from the menu script at random //Later this could possibly be chosen by the player ingredientSpawner.SelectDish(); //Sets up stations for first time use GetStations(true); //Instantiates and sets a completed dish and sets it as inactive for now completeDish = Instantiate <GameObject>(dishObject); completeDish.GetComponent <Item>().Type = MenuScript.IngredientType.dish; completeDish.SetActive(false); //Finds the cover object in the scene and deactivates it cover = GameObject.FindGameObjectWithTag("Cover"); cover.SetActive(false); //sets game state to playing state = stateEnum.playing; isScenePaused = false; //Finds cube object and gets its script cube = GameObject.FindGameObjectWithTag("Cube").GetComponent <CubeScript>(); //initailises score variable scoreCurrent = 0; //Allows MinigameScore script to set the number of dishes to make based on difficulty dishesCurrent = 0; if (dishesGoal <= 0) { dishesGoal = MinigameScores.DishTarget; } //Gets the attached ticketmanager script ticketManager = GetComponent <TicketManager>(); //Gets the ticket onject in the scene ticketObject = GameObject.FindGameObjectWithTag("Ticket"); //Initialises all the sprites for the ticket SetupTicket(); //Locks any station that wont be used for the first round if (oven.targetIngredients.Count <= 0) { oven.locked = true; } if (chopping.targetIngredients.Count <= 0) { chopping.locked = true; } if (blender.targetIngredients.Count <= 0) { blender.locked = true; } //ticket = GameObject.FindGameObjectWithTag("Ticket"); //Ticket start as open so ticket paues is true ticketPause = true; buttonPause = false; //Initialises all scores MinigameScores.ResetScores(); //new list to hold the currently spawned ingredients ingredientObjects = new List <GameObject>(); foreach (GameObject g in GameObject.FindGameObjectsWithTag("Holdable")) { ingredientObjects.Add(g); g.GetComponentInChildren <GlowScript>().SetGlowing(true); } }