public void LeaveScreen(ScreenContainer i_screen) { if (i_screen) { i_screen.OnPlayerExitScreen(); } }
public void EnterScreen(ScreenContainer i_screen) { if (i_screen) { i_screen.OnPlayerEnterScreen(); } }
public void Update() { if (PlayerManager.Instance.CurrentPlayer != null) { Vector3Int playerLocation = m_grid.WorldToCell(PlayerManager.Instance.CurrentPlayer.transform.position); ScreenContainer desiredScreen = m_index.GetComponentAt <ScreenContainer>(playerLocation); if (m_currentLocation == null || m_currentLocation.Value != playerLocation) { //Debug.Log($"Changing to {desiredScreen} at {playerLocation}."); var oldScreen = CurrentScreen; EnterScreen(desiredScreen); if (ScreenCamera) { ScreenCamera.GridPos = playerLocation; } m_currentLocation = playerLocation; CurrentScreen = desiredScreen; LeaveScreen(oldScreen); } } }