コード例 #1
0
    void Update()
    {
        // Ввод движение
        inputH = Input.GetAxisRaw("Horizontal");
        inputV = Input.GetAxisRaw("Vertical");

        if (inputH == 0f && inputV == 0f)
        {
            animator.SetBool("run", false);
        }
        else
        {
            animator.SetBool("run", true);
        }

        Vector3 moveInput    = new Vector3(inputH, 0f, inputV);
        Vector3 moveVelocity = moveInput.normalized * moveSpeed;

        playerController.Move(moveVelocity);

        // Ввод взгляд
        Ray   ray   = Camera.main.ScreenPointToRay(Input.mousePosition);
        Plane plane = new Plane(Vector3.up, Vector3.up * 1f);
        float rayDist;

        if (plane.Raycast(ray, out rayDist))
        {
            Vector3 point = ray.GetPoint(rayDist);
            playerController.LookAtMouse(point);
            cross.position        = point;
            cameraTarget.position = Vector3.Lerp(transform.position, cross.position, 0.1f);
        }

        // Ввод прыжок
        if (Input.GetKeyDown(KeyCode.Space))
        {
            playerController.Jump();
        }

        // Ввод стрельба

        if (Input.GetMouseButton(0))
        {
            animator.Play("IDLE_SHOOT");
            //gunController.CmdShoot();
        }
    }
コード例 #2
0
    public void Jump()
    {
        moveController.Jump(0);

        //アニメーション再生?
    }