Exemple #1
0
    /// <summary>
    /// Returns the the holdable item component of an ingredient spawned
    /// </summary>
    /// <returns></returns>
    public override HoldableItem GetHoldableItem()
    {
        // Instantiate the food referent prefab
        FoodGameObject instantiatedFood = Instantiate(ingredientToSpawn.IngredientPrefab, transform.position, ingredientToSpawn.IngredientPrefab.transform.rotation, transform.parent);

        // Return the holdable item component
        return(instantiatedFood.GetHoldableItemComponent());
    }
Exemple #2
0
    private void OnChoppingEnded(Choppable itemChopped)
    {
        Debug.Log("End of chop");
        // Call the on chop ending event
        OnChopEnding.Invoke(itemChopped);

        if (itemChopped.ChopComplete)
        {
            Debug.Log("Item chop complete");
            FoodGameObject choppedResult = Instantiate(itemChopped.ChoppedIngredient.IngredientPrefab, itemChopped.transform.position, itemChopped.transform.rotation);
            choppedResult.transform.parent = itemChopped.transform.parent;
            choppedResult.GetHoldableItemComponent().ToggleRigidBodyKinematic(true);
            OnChoppableItemUnboarded.Invoke(itemChopped);
            Destroy(itemChopped.gameObject);
        }

        _activeChoppingState = null;
    }