public void AddWater(Transform waterOrb) { // This if statement prevents the added water from remaining the selected material. // if (MouseLook.selectedItem != null && MouseLook.selectedItem == waterOrb) { waterOrb.GetComponent <Renderer>().material = gameManager.playerController.defaultMat; // Have to have this otherwise default mat doesn't reset and the next item you look out will turn into water. // gameManager.playerController.defaultMat = null; MouseLook.selectedItem = null; } // -------------------------------------------------------------------------------- // water = GameObject.Instantiate(waterOrb, waterOrb.position, waterOrb.rotation); water.tag = "NonInteractableWater"; water.GetComponent <SphereCollider>().isTrigger = true; // ------------------------------------------ Setting the CookingOrbState ------------------------------------------ // if (currentCookingOrbState == CookingOrbState.EMPTY) { currentCookingOrbState = CookingOrbState.EMPTY_WATER; } else if (currentCookingOrbState == CookingOrbState.INGREDIENTS_NOWATER) { currentCookingOrbState = CookingOrbState.INGREDIENTS_AND_WATER; } else if (currentCookingOrbState == CookingOrbState.INGREDIENTS_AND_WATER || currentCookingOrbState == CookingOrbState.EMPTY_WATER) { Debug.Log("Tried to add water to cooking orb but there is already water!"); } Debug.Log(currentCookingOrbState); // ----------------------------------------------------------------------------------------------------------------- // }
void UpdateCookingOrbState() { if (currentCookingOrbState != CookingOrbState.COOKING) { // ------------------------------------ Deleting the soup orb if it's currentPortions hit 0 ------------------------------------ // if (occupyingSoup != null && occupyingSoup.GetComponent <SoupData>().currentPortions <= 0) { occupyingSoup.gameObject.SetActive(false); occupyingSoup = null; // Freeing the cooking orb. // currentCookingOrbState = CookingOrbState.EMPTY; // Clearing the calculated stats to be ready for the next soup. calculatedSweet = 0; calculatedSpicy = 0; calculatedChunky = 0; } // ----------------------------------------------------------------------------------------------------------------------------- // else if (currentIngredients.Count > 0 && currentCookingOrbState == CookingOrbState.EMPTY) { currentCookingOrbState = CookingOrbState.INGREDIENTS_NOWATER; } else if (currentIngredients.Count > 0 && currentCookingOrbState == CookingOrbState.EMPTY_WATER) { currentCookingOrbState = CookingOrbState.INGREDIENTS_AND_WATER; } else if (currentIngredients.Count == 0 && currentCookingOrbState == CookingOrbState.INGREDIENTS_AND_WATER) { currentCookingOrbState = CookingOrbState.EMPTY_WATER; } } }
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // public void BeginCooking() { // Making the cooking orb state OCCUPIED. // currentCookingOrbState = CookingOrbState.COOKING; // Activating the fire particles. // fireParticles.gameObject.SetActive(true); SoundManager.SetSound(soundManager.cookingOrbSource, soundManager.cookingOrbCookingSound, true); SoundManager.PlaySound(soundManager.cookingOrbSource); SoundManager.SetSound(soundManager.cookingOrbSource2, soundManager.cookingOrbCookingSound2, true); SoundManager.PlaySound(soundManager.cookingOrbSource2); SoundManager.SetSound(soundManager.cookingOrbHatchSource, soundManager.hatchOpen, false); SoundManager.PlaySound(soundManager.cookingOrbHatchSource); }
// Start is called before the first frame update public void Start() { gameManager = GameManager.GetInstance(); soundManager = gameManager.soundManager; currentIngredients = new List <Transform>(); currentlyTrackedIngredients = new List <Transform>(); // Initialising cooking orb things. // currentCookingOrbState = CookingOrbState.EMPTY; currentSpicy = 0; currentChunky = 0; currentSweet = 0; shrinkingIngredients = new List <Transform>(); // Turning off the fire particles. // fireParticles.gameObject.SetActive(false); // Initialising the lightsMaterial. lightsMaterial = cookingOrbBase.GetComponent <Renderer>().material; }
// Update is called once per frame public void Update() { // Adding tracked ingredients to the cooking orb. // if (currentCookingOrbState == CookingOrbState.EMPTY_WATER || currentCookingOrbState == CookingOrbState.INGREDIENTS_AND_WATER) { AddTrackedIngredients(); } // Doing cooking timer. // if (currentCookingOrbState == CookingOrbState.COOKING) { cookingTimer += Time.deltaTime; if (cookingTimer >= spinningStartTime) { xRotation += ((360 * Time.deltaTime) / (cookingDuration - spinningStartTime)) * spinningSpeed; cookingOrb.localRotation = Quaternion.Euler(xRotation, cookingOrb.localRotation.y, cookingOrb.localRotation.z); } if (cookingTimer >= cookingDuration) { // De-activating the fire particles. // fireParticles.gameObject.SetActive(false); SoundManager.StopPlayingSound(soundManager.cookingOrbSource); SoundManager.StopPlayingSound(soundManager.cookingOrbSource2); SoundManager.SetSound(soundManager.cookingOrbSource, soundManager.cookingOrbSuccessSound, false); SoundManager.PlaySound(soundManager.cookingOrbSource); SoundManager.SetSound(soundManager.cookingOrbHatchSource, soundManager.hatchOpen, false); SoundManager.PlaySound(soundManager.cookingOrbHatchSource); MakeSoup(); // Resetting cookingTimer after cook. // cookingTimer = 0; currentCookingOrbState = CookingOrbState.OCCUPIED_SOUP; occupyingSoup.gameObject.SetActive(true); cookingOrb.GetComponent <Animator>().SetBool("IsOpen", false); } } // Moving water to the centre of the orb. // if (isCentered == false && water != null) { Debug.Log("CENTERING WATER..."); MoveWaterToCenter(); } // Cooking orb updates. // UpdateCookingOrbState(); UpdateCookingOrbAnimation(); ShrinkIngredients(); // Displaying current calculated stats. // DisplaySoupStats(calculatedSpicy, calculatedChunky, calculatedSweet); }