private void AddCookable(CookableObject cookable) { if (!cookableObjects.Contains(cookable)) { cookableObjects.Add(cookable); } }
private void OnTriggerExit(Collider other) { CookableObject cookable = GetCookableObject(other); if (!cookable) { return; } RemoveCookable(cookable); }
private void OnTriggerEnter(Collider other) { CookableObject cookable = GetCookableObject(other); if (!cookable) { return; } AddCookable(cookable); }
void Start() { //get the interactable component and add interactions to it interactableComponent = GetComponent <InteractableBase>(); interactableComponent.AddInteractionToList("On Place In Container", OnPlaceInContainer); //get the image component and set the sprite imageComponent = GetComponent <Image>(); cookableObject = GetComponent <CookableObject>(); cookableObject.OnCookOveride = OnCookOveride; ChangeSpaghettiState(SpaghettiState.Boxed); }
// Author: Trenton Plager /// <summary> /// Updates the meatball state and image based on the food cook state /// </summary> private void Update() { CookableObject test = GetComponent <CookableObject>(); // If the egg is fully cooked if (GetComponent <CookableObject>().IsCooked) { // Update it's state and image ChangeMeatballState(MeatballStates.LooseCoooked); } // If the sauce is scorched if (GetComponent <CookableObject>().IsBurnt) { ChangeMeatballState(MeatballStates.LooseBurned); } }
// Author: Trenton Plager /// <summary> /// A helper method that cooks food depending on the current burner it is on /// </summary> /// <param name="currentFood">The food that needs to be cooked</param> /// <param name="burner">The burner that the food is on</param> public void CookFoodHelper(CookableObject currentFood, StoveLocation burner) { int burnerTemp = stoveTemps.GetBurnerTemp(burner); switch (burnerTemp) { case 1: currentFood.Cook(timeToSkip * currentFood.LowHeatMultiplier); break; case 2: currentFood.Cook(timeToSkip * currentFood.MediumHeatMultiplier); break; case 3: currentFood.Cook(timeToSkip * currentFood.HighHeatMultiplier); break; } }
// Author: Nick Engell, Trenton Plager /// <summary> /// Goes through the utensils and attemps to cook the food in them /// </summary> private void AttemptToCookObjects() { // Loop through all the utensils for (int i = 0; i < listOfUtensils.Count; i++) { // Store a reference to the current utensil CookingUtensil currentUtensil = listOfUtensils[i].GetComponent <CookingUtensil>(); // If the current one is on the stove and there is a food in it if (currentUtensil.IsOnStove && currentUtensil.FoodsInside != null) { // Store a reference to the current food in the utensil CookableObject[] currentFoods = currentUtensil.FoodsInside; for (int j = 0; j < currentFoods.Length; j++) { CookableObject currentFood = currentFoods[j]; // Check which burner it's on CookFoodHelper(currentFood, currentUtensil.CurrentBurner); } } } }
private void RemoveCookable(CookableObject cookable) { cookableObjects.Remove(cookable); }
private void Awake() { Physics = GetComponent <PhysicsComponent>(); cookable = GetComponent <CookableObject>(); }