public void cancelLetterBox() { myCanvas.SetActive(false); currentLetterBoxState = eLetterBoxState.OUT; topBox.gameObject.SetActive(false); bottomBox.gameObject.SetActive(false); }
public void moveOutLetterBox() { myCanvas.SetActive(true); currentLetterBoxState = eLetterBoxState.MOVING_OUT; topBox.anchoredPosition3D = viewedPositionTop; bottomBox.anchoredPosition3D = viewedPositionBottom; topBox.gameObject.SetActive(true); bottomBox.gameObject.SetActive(true); }
void Update() { #if UNITY_EDITOR if (Input.GetKeyDown(KeyCode.Backspace)) { Debug.Log("debug show letterbox"); moveInLetterBox(); } if (Input.GetKeyDown(KeyCode.Alpha0)) { Debug.Log("debug hide letterbox"); moveOutLetterBox(); } #endif if (currentLetterBoxState == eLetterBoxState.MOVING_IN) { topBox.Translate(-transitionStepSize * Time.deltaTime); bottomBox.Translate(transitionStepSize * Time.deltaTime); if (topBox.anchoredPosition3D.y <= viewedPositionTop.y) { topBox.anchoredPosition3D = viewedPositionTop; bottomBox.anchoredPosition3D = viewedPositionBottom; currentLetterBoxState = eLetterBoxState.IN; } } else if (currentLetterBoxState == eLetterBoxState.MOVING_OUT) { topBox.Translate(transitionStepSize * Time.deltaTime); bottomBox.Translate(-transitionStepSize * Time.deltaTime); if (topBox.anchoredPosition3D.y >= homePositionTop.y) { topBox.anchoredPosition3D = homePositionTop; bottomBox.anchoredPosition3D = homePositionBottom; cancelLetterBox(); } } }