Пример #1
0
    // Update is called once per frame
    void LateUpdate()
    {
        TargetFollowCamera.target       = target;
        TargetFollowCamera.targetOffset = targetOffset;
        TargetFollowCamera.damping      = damping;

        if (updateRotation)
        {
            var mX = RPGInputManager.GetAxis("Mouse X", false);
            var mY = RPGInputManager.GetAxis("Mouse Y", false);
            TargetFollowCamera.xRotation -= mY * rotationSpeed;
            if (limitXRotation)
            {
                TargetFollowCamera.xRotation = Mathf.Clamp(TargetFollowCamera.xRotation, minXRotation, maxXRotation);
            }
            TargetFollowCamera.yRotation += mX * rotationSpeed;
            if (limitYRotation)
            {
                TargetFollowCamera.yRotation = Mathf.Clamp(TargetFollowCamera.yRotation, minYRotation, maxYRotation);
            }
        }

        if (updateZoom)
        {
            var mZ = RPGInputManager.GetAxis("Mouse ScrollWheel", false);
            TargetFollowCamera.zoomDistance += mZ * zoomSpeed;
            if (limitZoomDistance)
            {
                TargetFollowCamera.zoomDistance = Mathf.Clamp(TargetFollowCamera.zoomDistance, minZoomDistance, maxZoomDistance);
            }
        }
    }
Пример #2
0
    public void OnPointerUp(PointerEventData data)
    {
        if (!isDragging)
        {
            return;
        }
        if (data.pointerId != touchId)
        {
            return;
        }

        isDragging = false;
        touchId    = -1;
        movementController.position = defaultControllerPosition;
        if (movementBackground != null)
        {
            movementBackground.position = backgroundOffset + movementController.position;
        }

        if (useAxisX)
        {
            RPGInputManager.SetAxis(axisXName, 0);
        }

        if (useAxisY)
        {
            RPGInputManager.SetAxis(axisYName, 0);
        }
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (RPGInputManager.GetButtonDown("Jump"))
        {
            Debug.Log("Press Jump");
        }
        if (RPGInputManager.GetButtonUp("Jump"))
        {
            Debug.Log("Release Jump");
        }
        if (RPGInputManager.GetButton("Jump"))
        {
            Debug.Log("Hold Jump");
        }

        float hAxis = RPGInputManager.GetAxis("Horizontal", false);
        float vAxis = RPGInputManager.GetAxis("Vertical", false);

        if (hAxis != 0)
        {
            Debug.Log("hAxis " + hAxis);
        }
        if (vAxis != 0)
        {
            Debug.Log("vAxis " + vAxis);
        }
    }
Пример #4
0
    public void UpdateVirtualAxes(Vector3 value)
    {
        value = value.normalized;

        if (useAxisX)
        {
            RPGInputManager.SetAxis(axisXName, value.x);
        }

        if (useAxisY)
        {
            RPGInputManager.SetAxis(axisYName, value.y);
        }
    }
Пример #5
0
    private void UpdateVirtualAxes(Vector3 value)
    {
        var delta = startDragPosition - value;

        delta.y = -delta.y;
        delta  /= movementRange;
        if (useAxisX)
        {
            RPGInputManager.SetAxis(axisXName, -delta.x);
        }

        if (useAxisY)
        {
            RPGInputManager.SetAxis(axisYName, delta.y);
        }
    }
Пример #6
0
 public void OnPointerDown(PointerEventData eventData)
 {
     RPGInputManager.SetButtonDown(keyName);
 }