Пример #1
0
    public override bool TryHandleInput(ClawMachineController clawMachineController)
    {
        if (Input.GetKey(KeyCode.LeftArrow))
        {
            clawMachineController.Move(Vector3.left);
        }
        else if (Input.GetKey(KeyCode.RightArrow))
        {
            clawMachineController.Move(Vector3.right);
        }
        else if (Input.GetKey(KeyCode.UpArrow))
        {
            clawMachineController.Move(Vector3.forward);
        }
        else if (Input.GetKey(KeyCode.DownArrow))
        {
            clawMachineController.Move(Vector3.back);
        }
        else if (Input.GetKey(KeyCode.Space))
        {
            clawMachineController.Hit();
        }
        else
        {
            return(false);
        }

        return(true);
    }
Пример #2
0
    public override bool TryHandleInput(ClawMachineController clawMachineController)
    {
        bool result = false;

        if (_joystickController.IsControlActive)
        {
            clawMachineController.Move(_joystickController.ForceDirection);

            result |= true;
        }

        if (_buttonController.IsTrigger)
        {
            clawMachineController.Hit();

            result |= true;
        }

        return(result);
    }