input refactored

This commit is contained in:
Mausham
2025-12-15 21:51:34 +05:45
parent a166fe2861
commit 05287c4b73
10 changed files with 41 additions and 25 deletions

View File

@@ -12,6 +12,7 @@ public class DeathScreenController:IDeathScreenController
[Inject] private IInputReader IinputReader;
[Inject] private IAudioController IaudioController;
[Inject] private IGameSession IgameSession;
[Inject] private IGameScreenController IgameScreenController;
public DeathScreenController(DeathScreenView _deathScreenView)
{
deathScreenView = _deathScreenView;
@@ -21,6 +22,7 @@ public class DeathScreenController:IDeathScreenController
public void ShowDeathScreen()
{
IgameScreenController.HideGameScreen();
deathScreenView.Show(IscoreService.score,IscoreService.highScore);
}
@@ -38,6 +40,7 @@ public class DeathScreenController:IDeathScreenController
Debug.Log("Restart Button Clicked");
IinputReader.UnlockInput();
IaudioController.PlayBtnPressedSound();
IgameSession.showStartScreen = false;
SceneManager.LoadScene(0);
}
}

View File

@@ -33,6 +33,11 @@ public class GameScreenController: IGameScreenController
gameScreenView.Show();
}
public void HideGameScreen()
{
gameScreenView.Hide();
}
public void OnPauseButtonClicked()
{
IaudioController.PlayBtnPressedSound();
@@ -45,4 +50,5 @@ public class GameScreenController: IGameScreenController
public interface IGameScreenController {
void ShowGameScreen();
void HideGameScreen();
}

View File

@@ -8,6 +8,7 @@ public class PauseScreenController:IPauseScreenController
private PauseScreenView pauseScreenView;
[Inject] private IInputReader IinputReader;
[Inject] private IAudioController IaudioController;
[Inject] private IGameSession IgameSession;
public PauseScreenController(PauseScreenView _pauseScreenView)
{
@@ -26,6 +27,7 @@ public class PauseScreenController:IPauseScreenController
Time.timeScale = 1.0f;
IinputReader.UnlockInput();
IaudioController.PlayBtnPressedSound();
IgameSession.showStartScreen = false;
SceneManager.LoadScene(0); //Restart This Scene
}