예제 #1
0
    private void ProcessInput()
    {
        // Button down press
        if (Input.GetButtonDown("Action"))
        {
            pc.Action();
        }
        if (Input.GetButtonDown("AltAction"))
        {
            pc.AltAction();
        }
        if (Input.GetButtonDown("Cancel"))
        {
            pc.Cancel();
        }
        if (Input.GetButtonDown("Start"))
        {
            pc.Start();
        }

        // Button up
        if (Input.GetButtonUp("Action"))
        {
            pc.ActionRelease();
        }
        if (Input.GetButtonUp("AltAction"))
        {
            pc.AltActionRelease();
        }
        if (Input.GetButtonUp("Cancel"))
        {
            pc.CancelRelease();
        }
        if (Input.GetButtonUp("Start"))
        {
            pc.StartRelease();
        }

        // Axes
        float hAxis = Input.GetAxisRaw("Horizontal");
        float vAxis = Input.GetAxisRaw("Vertical");

        pc.Horizontal(hAxis);
        pc.Vertical(vAxis);
        if (hAxis == 0 && vAxis == 0)
        {
            pc.Idle();
        }
    }