// Get CurrentPosition private void GetCurrentPosition(Vector2 touchPos) { defaultPosition = currentPosition = joystickBackgroundRT.position; if (axisX.enabled) { currentPosition.x = GuiCamera.ScreenToWorldPoint(touchPos).x; } if (axisY.enabled) { currentPosition.y = GuiCamera.ScreenToWorldPoint(touchPos).y; } }
// GetCurrent Position protected void GetCurrentPosition(Vector2 touchPos) { if (axisX.enabled) { currentPosition.x = GuiCamera.ScreenToWorldPoint(touchPos).x; } if (axisY.enabled) { currentPosition.y = GuiCamera.ScreenToWorldPoint(touchPos).y; } sizeX = baseRect.sizeDelta.x / 2f; sizeY = baseRect.sizeDelta.y / 2f; defaultPosition = baseRect.position; }
// Get CurrentPosition private void UpdateCurrentPosition(Vector2 touchPos) { defaultPosition = currentPosition = backgroundRT.position; Vector2 worldPoint = GuiCamera.ScreenToWorldPoint(touchPos); if (axisX.enabled) { currentPosition.x = worldPoint.x; } if (axisY.enabled) { currentPosition.y = worldPoint.y; } }
// GetCurrentPosition private void GetCurrentPosition(Vector2 touchPos) { defaultPosition = currentPosition = baseRect.position; currentPosition.x = GuiCamera.ScreenToWorldPoint(touchPos).x; currentPosition.y = GuiCamera.ScreenToWorldPoint(touchPos).y; }
// Update Transparency and Position for DynamicJoystick private void UpdateTransparencyAndPosition(Vector2 touchPos) { OnApplyVisible(); joystickImage.enabled = backgroundImage.enabled = true; joystickRT.position = backgroundRT.position = GuiCamera.ScreenToWorldPoint(touchPos); }