Exemple #1
0
    void InputDelegation()
    {
        //"GetAxisRaw("Horizontal")" returns values between -1 and 1 for either the AD keys or arrow keys
        // Same with "GetAxisVertical
        if (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0)
        {
            float horizontal_movement = 0f, forward_movement = 0f;
            if (Input.GetAxisRaw("Horizontal") > 0)
            {
                horizontal_movement = -1;
            }
            else if (Input.GetAxisRaw("Horizontal") < 0)
            {
                horizontal_movement = 1;
            }
            else if (Input.GetAxisRaw("Horizontal") == 0)
            {
                // playerMovementScript.resetForward();
            }
            if (Input.GetAxisRaw("Vertical") > 0)
            {
                forward_movement = -1;
            }
            else if (Input.GetAxisRaw("Vertical") < 0)
            {
                forward_movement = 1;
            }
            else if (Input.GetAxisRaw("Vertical") == 0)
            {
                //playerMovementScript.resetForward();
            }
            playerMovementScript.MoveCharacter(horizontal_movement, forward_movement);
            cameraBehavior.MoveCamera();
        }
        if (Input.GetKey(KeyCode.Q))
        {
            cameraBehavior.RotateCamera_Left();
        }
        else if (Input.GetKey(KeyCode.E))
        {
            cameraBehavior.RotateCamera_Right();
        }
        else
        {
            cameraBehavior.ResetCamera_OriginalAngle();
        }
        if (Input.GetKey(KeyCode.Space))
        {
            playerMovementScript.Stabilize();
        }

        else if (Input.GetKey(KeyCode.F))
        {
            if (touchedTriggers.Count == 1)
            {
                // Check character it is attached to
                // pass character name to FriendshipManager
            }
        }

        else
        {
            // This is then where we would add in other checks such as a key code for
            // opening dialogue, or inventory, or what have you
        }
    }