示例#1
0
    public bool Interact_Place(Ingredient_Full i)
    {
        //pass in an ingredient (usually the held ingredient from the player)
        //return a bool whether or not it was successful.
        if (storage == null)
        {
            Debug.Log("Chop chop!");
            switch (i.ingr)
            {
            case Recipe.Ingredient.Mushroom: storage = new Ingredient_Full(Recipe.Ingredient.Chopped_Mushroom); break;

            case Recipe.Ingredient.Onion: storage = new Ingredient_Full(Recipe.Ingredient.Chopped_Onion); break;

            case Recipe.Ingredient.Tomato: storage = new Ingredient_Full(Recipe.Ingredient.Chopped_Tomato); break;

            default: storage = i; break;
            }
            InfoCanvas.SetActive(true);
            DrawUI();
            return(true);
        }
        else
        {
            Debug.Log("There's something there already.");
            return(false);
        }
    }
示例#2
0
 public bool Interact_Place(Ingredient_Full i)
 {
     Debug.Log("PLACED " + i.ingr);
     storage.Add(i);
     drawPrepList();
     return(true);
 }
 void Start()
 {
     aud = GetComponent <AudioSource>();
     cam.transform.localPosition = new Vector3(-8.73f, 5.56f, 0.33f);
     holding             = null;
     currentInteractable = null;
     rb = GetComponent <Rigidbody>();
     holdingCanvas.SetActive(false);
     truckRB.centerOfMass = new Vector3(0, -2, 0);
 }
示例#4
0
 public Ingredient_Full Interact_Take()
 {
     //take something, return the ingredient taken so that the player can hold it in their script.
     if (storage == null)
     {
         Debug.Log("There's nothing on the table.");
         return(null);
     }
     else
     {
         Ingredient_Full ret = storage;
         storage = null;
         return(ret);
     }
 }
 public void submitRecipe()
 {
     if (currentInteractable == null && holding != null)
     {
         holding = null;
         holdingCanvas.SetActive(false);
         Debug.Log("Tossed!");
     }
     else if (currentInteractable.name == "PREP_TABLE1")
     {
         Debug.Log("PREP TABLE 1 CHECK");
         gm.SubmitRecipe(1);
     }
     else if (currentInteractable.name == "PREP_TABLE2")
     {
         Debug.Log("PREP TABLE 2 CHECK");
         gm.SubmitRecipe(2);
     }
 }
示例#6
0
    public bool Interact_Place(Ingredient_Full ri, int sideOfGrill)
    {
        //TODO: How to differentiate which half of the grill we're standing on
        if (ri.ingr != Recipe.Ingredient.Burger && ri.ingr != Recipe.Ingredient.Chopped_Onion && ri.ingr != Recipe.Ingredient.Chopped_Mushroom)
        {
            Debug.Log("YOU CANT COOK THAT");
            return(false);
        }
        else
        {
            if (sideOfGrill == 1)
            {
                if (L == null)
                {
                    L = ri;
                    LPanel.SetActive(true);
                    DrawUI(1);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                if (R == null)
                {
                    R = ri;
                    RPanel.SetActive(true);
                    DrawUI(2);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
    }
示例#7
0
    public Ingredient_Full Interact_Take(int sideOfGrill)
    {
        //same concept across the board for interactables- return the ingredient taken and remove it from that spot.

        if (sideOfGrill == 1)
        {
            if (L != null)
            {
                Ingredient_Full ret = L;
                L = null;
                LPanel.SetActive(false);
                return(ret);
            }
            else
            {
                return(null);
            }
        }
        else if (sideOfGrill == 2)
        {
            if (R != null)
            {
                Ingredient_Full ret = R;
                R = null;
                RPanel.SetActive(false);
                return(ret);
            }
            else
            {
                return(null);
            }
        }
        else
        {
            return(null); //what
        }
    }
    public void Interact()
    {
        //there is, quite frankly, a lot of code here.
        //interact with anything you're nearby
        if (currentInteractable.CompareTag("Interactable_Pickup"))
        {
            if (holding == null)
            {
                switch (currentInteractable.name)
                {
                case "TOP_BUNS": holding = new Ingredient_Full(Recipe.Ingredient.Top_Bun); break;

                case "BOTTOM_BUNS": holding = new Ingredient_Full(Recipe.Ingredient.Bottom_Bun); break;

                case "BURGERS": holding = new Ingredient_Full(Recipe.Ingredient.Burger); break;

                case "CHEESE": holding = new Ingredient_Full(Recipe.Ingredient.Cheese); break;

                case "ONION": holding = new Ingredient_Full(Recipe.Ingredient.Onion); break;

                case "LETTUCE": holding = new Ingredient_Full(Recipe.Ingredient.Lettuce); break;

                case "MUSHROOM": holding = new Ingredient_Full(Recipe.Ingredient.Mushroom); break;

                case "TOMATO": holding = new Ingredient_Full(Recipe.Ingredient.Tomato); break;
                }
                Debug.Log("Now holding " + holding.ingr);
                aud.Play();
            }
            else
            {
                Debug.Log("You're already holding something!");
            }
        }
        else if (currentInteractable.CompareTag("Interactable_Utility"))
        {
            if (holding != null)
            {
                if (currentInteractable.name == "GRILL_L")
                {
                    if (currentInteractable.transform.parent.gameObject.GetComponent <Grill>().Interact_Place(holding, 1))
                    {
                        holding = null;
                        holdingCanvas.SetActive(false);
                        aud.Play();
                    }
                    else
                    {
                        //grill is full
                    }
                }
                else if (currentInteractable.name == "GRILL_R")
                {
                    if (currentInteractable.transform.parent.gameObject.GetComponent <Grill>().Interact_Place(holding, 2))
                    {
                        holding = null;
                        holdingCanvas.SetActive(false);
                        aud.Play();
                    }
                    else
                    {
                        //grill is full
                    }
                }
                else if (currentInteractable.name == "CHOP_TABLE")
                {
                    if (currentInteractable.GetComponent <ChopTable>().Interact_Place(holding))
                    {
                        holding = null;
                        holdingCanvas.SetActive(false);
                        aud.Play();
                    }
                    else
                    {
                        //chop table is full
                    }
                }
                else if (currentInteractable.name == "PREP_TABLE1" || currentInteractable.name == "PREP_TABLE2")
                {
                    if (currentInteractable.GetComponent <PrepTable>().Interact_Place(holding))
                    {
                        holding = null;
                        holdingCanvas.SetActive(false);
                        aud.Play();
                    }
                }
                else if (currentInteractable.name == "DRIVER_SEAT" && gm.requestsDone > 0)
                {
                    truckMode             = true;
                    truckScript.truckMode = true;
                    CameraModeSwitch();
                    aud.Play();
                }
            }
            else
            {
                if (currentInteractable.name == "GRILL_L")
                {
                    holding = currentInteractable.transform.parent.gameObject.GetComponent <Grill>().Interact_Take(1);
                    if (holding == null)
                    {
                        Debug.Log("Grill was empty");
                    }
                    else
                    {
                        Debug.Log("Now holding " + holding.ingr);
                        aud.Play();
                    }
                }
                else if (currentInteractable.name == "GRILL_R")
                {
                    holding = currentInteractable.transform.parent.gameObject.GetComponent <Grill>().Interact_Take(2);
                    if (holding == null)
                    {
                        Debug.Log("Grill was empty");
                    }
                    else
                    {
                        Debug.Log("Now holding " + holding.ingr);
                        aud.Play();
                    }
                }
                else if (currentInteractable.name == "CHOP_TABLE")
                {
                    holding = currentInteractable.GetComponent <ChopTable>().Interact_Take();
                    if (holding == null)
                    {
                        Debug.Log("Table was empty");
                    }
                    else
                    {
                        Debug.Log("Now holding " + holding.ingr);
                        aud.Play();
                    }
                }
                else if (currentInteractable.name == "PREP_TABLE1" || currentInteractable.name == "PREP_TABLE2")
                {
                    holding = currentInteractable.GetComponent <PrepTable>().Interact_Take();
                    if (holding == null)
                    {
                        Debug.Log("Table was empty");
                    }
                    else
                    {
                        Debug.Log("Now holding " + holding.ingr);
                        aud.Play();
                    }
                }
                else if (currentInteractable.name == "DRIVER_SEAT")
                {
                    truckMode             = true;
                    truckScript.truckMode = true;
                    CameraModeSwitch();
                    aud.Play();
                }
            }
        }
    }