Пример #1
0
    // Update is called once per frame
    void Update()
    {
        //horizontal = Input.GetAxis("Horizontal_P1");  //360 Controller
        //vertical = Input.GetAxis("Vertical_P1");
        horizontal = Input.GetAxis("Horizontal_P1");
        vertical   = Input.GetAxis("Vertical_P1");
        //horizontalRight = Input.GetAxis("HorizontalRight_P1");
        //verticalRight = Input.GetAxis("VerticalRight_P1");
        horizontalRight = -Input.GetAxis("HorizontalRight_P1");
        verticalRight   = Input.GetAxis("VerticalRight_P1");

        p1Movement.MoveInput(horizontal, vertical);
        p1Look.LookInput(horizontalRight, verticalRight);

        //Debug.Log(Input.GetAxis("DpadHorizontal_P1"));

        if (Input.GetAxisRaw("DpadHorizontal_P1") == -1)
        {
            //Debug.Log("Dpad horizontal -1");
            DpadCall(DpadInputs.Left);
            //if (Input.GetButtonDown("360_A_Button")){
            APlusDpad(DpadInputs.Left);
            //}
        }
        else if (Input.GetAxisRaw("DpadHorizontal_P1") == 1)
        {
            //Debug.Log("Dpad horizontal 1");
            DpadCall(DpadInputs.Right);
            //if (Input.GetButtonDown("360_A_Button"))
            //{
            APlusDpad(DpadInputs.Right);
            //}
        }
        else if (Input.GetAxisRaw("DpadVertical_P1") == 1)
        {
            // Debug.Log("Dpad vertical 1");
            DpadCall(DpadInputs.Up);
            //if (Input.GetButtonDown("360_A_Button"))
            // {
            APlusDpad(DpadInputs.Up);
            //}
        }
        else if (Input.GetAxisRaw("DpadVertical_P1") == -1)
        {
            //Debug.Log("Dpad vertical -1");
            DpadCall(DpadInputs.Down);
            //if (Input.GetButtonDown("360_A_Button"))
            // {
            APlusDpad(DpadInputs.Down);
            //}
        }
        else if (Input.GetButtonDown("360_A_Button"))
        {
            APressed();
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        p2Look = p2Movement.cameras[p2Movement.currentCamera].GetComponent <SimpleSmoothMouseLook>();
        //horizontal = Input.GetAxis("Horizontal_P1");  //360 Controller
        //vertical = Input.GetAxis("Vertical_P1");
        horizontal = (Input.GetButtonDown("Left_P2") ? -1 : 0) + (Input.GetButtonDown("Right_P2") ? 1 : 0);
        //horizontalRight = Input.GetAxis("HorizontalRight_P1");
        //verticalRight = Input.GetAxis("VerticalRight_P1");
        horizontalRight = -Input.GetAxis("Mouse X");
        verticalRight   = Input.GetAxis("Mouse Y");

        p2Movement.MoveInput(horizontal);
        p2Look.LookInput(horizontalRight, verticalRight);
    }
    // Update is called once per frame
    void Update()
    {
        movement = Vector3.zero;

        p2FreeLook      = p2Camera.GetComponent <SimpleSmoothMouseLook>();
        horizontalRight = -Input.GetAxis("Mouse X");
        verticalRight   = Input.GetAxis("Mouse Y");
        p2FreeLook.LookInput(horizontalRight, verticalRight);


        if (Input.GetButton("Forward_P2"))
        {
            movement.z += speed;
        }

        if (Input.GetButton("Backward_P2"))
        {
            movement.z -= speed;
        }

        if (Input.GetButton("Left_P2"))
        {
            movement.x -= speed;
        }

        if (Input.GetButton("Right_P2"))
        {
            movement.x += speed;
        }

        if (Input.GetKey(KeyCode.LeftShift))
        {
            movement.y -= speed;
        }

        if (Input.GetKey(KeyCode.Space))
        {
            movement.y += speed;
        }

        transform.Translate(movement * Time.deltaTime);
    }