Пример #1
0
    void Update()
    {
        moveVector  = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
        mouseVector = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));

        UpdateCamera();

        if (Input.GetKeyDown(KeyCode.E))
        {
            if (InVehicle())
            {
                vehicleTransform.GetComponent <BaseMountable>().DropDriver();
            }
            else if (CameraLookEntity().GetComponent <BaseMountable>() != null)
            {
                BaseMountable vehicle = CameraLookEntity().GetComponent <BaseMountable>();

                if (!vehicle.IsUsed())
                {
                    vehicle.EnterVehicle(transform);
                }
            }
        }
    }