/// <summary> /// UGUI method switch the panel. /// </summary> /// <param name="towardDirection"> direction to switch scene. </param> private void UGUISwitchScene(JCS_2D4Direction towardDirection) { // get the Screen Width and Screen Height JCS_ScreenSettings ss = JCS_ScreenSettings.instance; float screenWidth = ss.STARTING_SCREEN_WIDTH; float screenHeight = ss.STARTING_SCREEN_HEIGHT; // make a copy of old position Vector3 newScenePosition = Vector3.zero; switch (towardDirection) { case JCS_2D4Direction.TOP: newScenePosition.y += screenHeight; break; case JCS_2D4Direction.BOTTOM: newScenePosition.y -= screenHeight; break; case JCS_2D4Direction.RIGHT: newScenePosition.x += screenWidth; break; case JCS_2D4Direction.LEFT: newScenePosition.x -= screenWidth; break; } mPanelHolder.AddForce(newScenePosition); }
/// <summary> /// UGUI method switch the panel. /// </summary> /// <param name="towardDirection"> direction to switch scene. </param> private void UGUISwitchScene(JCS_2D4Direction towardDirection) { // get the Screen Width and Screen Height Vector2 screenSize = GetScreenSize(); float screenWidth = screenSize.x; float screenHeight = screenSize.y; // make a copy of old position Vector3 newScenePosition = Vector3.zero; switch (towardDirection) { case JCS_2D4Direction.TOP: newScenePosition.y += screenHeight; break; case JCS_2D4Direction.BOTTOM: newScenePosition.y -= screenHeight; break; case JCS_2D4Direction.RIGHT: newScenePosition.x += screenWidth; break; case JCS_2D4Direction.LEFT: newScenePosition.x -= screenWidth; break; } mPanelHolder.AddForce(newScenePosition); }
private void Update() { #if (UNITY_EDITOR) Test(); #endif if (mPanelHolder != null) { JCS_SlideInput si = JCS_InputManager.instance.GetJCSSlideInput(); if (si != null) { mPanelHolder.AddForce(-si.DeltaPos.x, JCS_Axis.AXIS_X); mPanelHolder.AddForce(-si.DeltaPos.y, JCS_Axis.AXIS_Y); } } }