Пример #1
0
 public void LeaveScreen(ScreenContainer i_screen)
 {
     if (i_screen)
     {
         i_screen.OnPlayerExitScreen();
     }
 }
Пример #2
0
 public void EnterScreen(ScreenContainer i_screen)
 {
     if (i_screen)
     {
         i_screen.OnPlayerEnterScreen();
     }
 }
Пример #3
0
 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);
         }
     }
 }