Помогите сделать прыжок под телефоны

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class Move : MonoBehaviour{

    public Joystick joystick;

    public float speed = 7f; //Скорость игрока.

    private float vertical;
    private float horizontal;
    private void Update()
    {
        GetMobileInput();
    }
    private void GetMobileInput()
    {
        vertical = joystick.Vertical;
        horizontal = joystick.Horizontal;

        if (vertical >= 0.5f)
        {
            transform.localPosition += transform.forward * speed * Time.deltaTime;
        }
        
        if (vertical <= -0.5f)
        {
            transform.localPosition += -transform.forward * speed * Time.deltaTime;
        }

        if (horizontal >= 0.5f)
        {
            transform.localPosition += transform.right * speed * Time.deltaTime;
        }

        if (horizontal <= -0.5f)
        {
            transform.localPosition += -transform.right * speed * Time.deltaTime;
        }
                       
    }
}

Ответы (0 шт):