Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape) && player1 != null && player1.destination == transform)
        {
            player1.ResetVegetableButtons();
            Debug.Log("reset");
        }

        //what to do when player has picked up a vegetable
        if (Input.GetKeyDown(KeyCode.A) && canpickup)
        {
            player1.CloseVegButtons();

            Player1GoToChopButton1.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = "S";
            Player1GoToChopButton1.transform.GetChild(1).GetComponent <Text>().text             = "Go to Chopping Board";
            Player1GoToChopButton1.SetActive(true);

            //Player1GoToChopButton2.transform.GetChild(0).GetChild(0).GetComponent<Text>().text = "D";
            //Player1GoToChopButton2.transform.GetChild(1).GetComponent<Text>().text = "Go to Chopping Board2";
            //Player1GoToChopButton2.SetActive(true);

            Player1PickAnotherVegButton.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = "Esc";
            Player1PickAnotherVegButton.transform.GetChild(1).GetComponent <Text>().text             = "Pick other Vegetable";
            Player1PickAnotherVegButton.SetActive(true);

            if (player1.vegetablesCarryingArray[0] == null || player1.vegetablesCarryingArray[1] == null)
            {
                Player1PickupAgainButton.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = "A";
                Player1PickupAgainButton.transform.GetChild(1).GetComponent <Text>().text             = "Pickup Again";
                Player1PickupAgainButton.SetActive(true);
            }
            else
            {
                Player1PickupAgainButton.SetActive(false);
            }

            player1.SelectVegetable(vegId, orderCalculationID);
        }

        //Player2 Zone
        if (Input.GetKeyDown(KeyCode.Backspace) && player2 != null && player2.destination == transform)
        {
            player2.ResetVegetableButtons();
            Debug.Log("reset");
        }

        if (Input.GetKeyDown(KeyCode.L) && player2pickup)
        {
            player2.SelectVegetable(vegId, orderCalculationID);

            player2.CloseVegButtons();

            //Player2GoToChopButton1.transform.GetChild(0).GetChild(0).GetComponent<Text>().text = ";";
            //Player2GoToChopButton1.transform.GetChild(1).GetComponent<Text>().text = "Go to Chopping Board1";
            //Player2GoToChopButton1.SetActive(true);

            Player2GoToChopButton2.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = "'";
            Player2GoToChopButton2.transform.GetChild(1).GetComponent <Text>().text             = "Go to Chopping Board";
            Player2GoToChopButton2.SetActive(true);

            Player2PickAnotherVegButton.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = "Backspace";
            Player2PickAnotherVegButton.transform.GetChild(1).GetComponent <Text>().text             = "Pick other Vegetable";
            Player2PickAnotherVegButton.SetActive(true);

            if (player2.vegetablesCarryingArray[0] == null || player2.vegetablesCarryingArray[1] == null)
            {
                Player2PickupAgainButton.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = "L";
                Player2PickupAgainButton.transform.GetChild(1).GetComponent <Text>().text             = "Pickup Again";
                Player2PickupAgainButton.SetActive(true);
            }
            else
            {
                Player2PickupAgainButton.SetActive(false);
            }
        }

        else
        {
            return;
        }
    }