Пример #1
0
    // Update is called once per frame
    void Update()
    {
        //drop a vegetable to chop
        if (Input.GetKeyDown(KeyCode.Space) && canDrop)
        {
            Chop();
            canDrop = false;
        }

        //pickup salad bowl after chopping
        else if (Input.GetKeyDown(KeyCode.Space) && choppingDone)
        {
            PickUpSaladBowl();
            choppingDone = false;
        }
        //chop another vegetable in hand
        else if (Input.GetKeyDown(KeyCode.LeftAlt) && choppingDone)
        {
            Chop();
            canDrop = false;
        }
        //drop a vegetable at side plate
        else if (Input.GetKeyDown(KeyCode.LeftControl) && canDrop && !canPickupFromSideTable)
        {
            DropAtSidePlate();
        }
        //pickup vegetable from side plate
        else if (Input.GetKeyDown(KeyCode.LeftControl) && canPickupFromSideTable)
        {
            PickUpFromSidePlate();
        }
        //trash salad bowl
        else if (Input.GetKeyDown(KeyCode.LeftShift) && choppingDone)
        {
            Trash();
        }
        //serve salad to customer
        else if (Input.GetKeyDown(KeyCode.Tab) && choppingDone)
        {
            player1.OpenServeButtons();
        }


        //Player2 Actions
        if (Input.GetKeyDown(KeyCode.Return) && canDrop)
        {
            Player2Chop();
            canDrop = false;
        }

        else if (Input.GetKeyDown(KeyCode.Return) && choppingDone)
        {
            Player2PickUpSaladBowl();
            choppingDone = false;
        }
        else if (Input.GetKeyDown(KeyCode.RightAlt) && choppingDone)
        {
            Player2Chop();
            canDrop = false;
        }

        else if (Input.GetKeyDown(KeyCode.RightControl) && canDrop && !canPickupFromSideTable)
        {
            Player2DropAtSidePlate();
        }
        else if (Input.GetKeyDown(KeyCode.RightControl) && canPickupFromSideTable)
        {
            Player2PickUpFromSidePlate();
        }

        else if (Input.GetKeyDown(KeyCode.RightShift) && choppingDone)
        {
            Player2Trash();
        }
        else if (Input.GetKeyDown(KeyCode.Backslash) && choppingDone)
        {
            player2.OpenServeButtons();
        }
    }