コード例 #1
0
 private void AddCookable(CookableObject cookable)
 {
     if (!cookableObjects.Contains(cookable))
     {
         cookableObjects.Add(cookable);
     }
 }
コード例 #2
0
    private void OnTriggerExit(Collider other)
    {
        CookableObject cookable = GetCookableObject(other);

        if (!cookable)
        {
            return;
        }

        RemoveCookable(cookable);
    }
コード例 #3
0
    private void OnTriggerEnter(Collider other)
    {
        CookableObject cookable = GetCookableObject(other);

        if (!cookable)
        {
            return;
        }

        AddCookable(cookable);
    }
コード例 #4
0
    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);
    }
コード例 #5
0
    // 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);
        }
    }
コード例 #6
0
    // 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;
        }
    }
コード例 #7
0
    // 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);
                }
            }
        }
    }
コード例 #8
0
 private void RemoveCookable(CookableObject cookable)
 {
     cookableObjects.Remove(cookable);
 }
コード例 #9
0
 private void Awake()
 {
     Physics  = GetComponent <PhysicsComponent>();
     cookable = GetComponent <CookableObject>();
 }