added sounds
This commit is contained in:
34
Assets/Scripts/UI/DeathScreenController.cs
Normal file
34
Assets/Scripts/UI/DeathScreenController.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
public class DeathScreenController
|
||||
{
|
||||
private DeathScreenView deathScreenView;
|
||||
public event Action OnRestartPressed;
|
||||
public event Action OnExitPressed;
|
||||
|
||||
[Inject] private ScoreService scoreService;
|
||||
public DeathScreenController(DeathScreenView _deathScreenView)
|
||||
{
|
||||
deathScreenView = _deathScreenView;
|
||||
deathScreenView.restartBtn.onClick.AddListener(() => OnRestartPressed?.Invoke());
|
||||
deathScreenView.exitBtn.onClick.AddListener(()=>OnExitPressed?.Invoke());
|
||||
}
|
||||
|
||||
public void ShowDeathScreen()
|
||||
{
|
||||
deathScreenView.Show(scoreService.score,scoreService.highScore);
|
||||
}
|
||||
|
||||
private void OnExitButtonClicked()
|
||||
{
|
||||
Debug.Log("Exit Button Clicked");
|
||||
}
|
||||
|
||||
private void OnRestartButtonClicked()
|
||||
{
|
||||
Debug.Log("Restart Button Clicked");
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/DeathScreenController.cs.meta
Normal file
2
Assets/Scripts/UI/DeathScreenController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a02f33f5247de546a0a273165e9cf96
|
||||
24
Assets/Scripts/UI/DeathScreenView.cs
Normal file
24
Assets/Scripts/UI/DeathScreenView.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DeathScreenView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject deathScreen;
|
||||
public Button restartBtn;
|
||||
public Button exitBtn;
|
||||
public TextMeshProUGUI score;
|
||||
public TextMeshProUGUI highScore;
|
||||
|
||||
public void Show(int _score, int _highScore)
|
||||
{
|
||||
this.score.text = _score.ToString();
|
||||
this.highScore.text = _highScore.ToString();
|
||||
deathScreen.SetActive(true);
|
||||
}
|
||||
public void Hide()
|
||||
{
|
||||
deathScreen.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
2
Assets/Scripts/UI/DeathScreenView.cs.meta
Normal file
2
Assets/Scripts/UI/DeathScreenView.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76c438a869d58da489fc53c68f98d32d
|
||||
25
Assets/Scripts/UI/GameScreenController.cs
Normal file
25
Assets/Scripts/UI/GameScreenController.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
public class GameScreenController
|
||||
{
|
||||
GameScreenView gameScreenView;
|
||||
public event Action OnPausePressed;
|
||||
public GameScreenController(GameScreenView _gameScreenView)
|
||||
{
|
||||
this.gameScreenView = _gameScreenView;
|
||||
gameScreenView.pauseBtn.onClick.AddListener(()=>OnPausePressed?.Invoke());
|
||||
}
|
||||
|
||||
public void ShowGameScreen()
|
||||
{
|
||||
gameScreenView.Show();
|
||||
}
|
||||
|
||||
public void OnPauseButtonClicked()
|
||||
{
|
||||
Debug.Log("Paused Btn Clicked");
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/GameScreenController.cs.meta
Normal file
2
Assets/Scripts/UI/GameScreenController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 114040c725db5444583af5f21fd0e0b8
|
||||
25
Assets/Scripts/UI/GameScreenView.cs
Normal file
25
Assets/Scripts/UI/GameScreenView.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GameScreenView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject gameScreen;
|
||||
public Button pauseBtn;
|
||||
[SerializeField] private TextMeshProUGUI scoreText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
gameScreen.SetActive(false);
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
gameScreen.SetActive(true);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
gameScreen.SetActive(false);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/GameScreenView.cs.meta
Normal file
2
Assets/Scripts/UI/GameScreenView.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 808ee37de5cf8b546b46962c901f0332
|
||||
31
Assets/Scripts/UI/PauseScreenController.cs
Normal file
31
Assets/Scripts/UI/PauseScreenController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class PauseScreenController
|
||||
{
|
||||
private PauseScreenView pauseScreenView;
|
||||
public event Action OnResumePressed;
|
||||
public event Action OnRestartPressed;
|
||||
|
||||
public PauseScreenController(PauseScreenView _pauseScreenView)
|
||||
{
|
||||
pauseScreenView = _pauseScreenView;
|
||||
pauseScreenView.resumeBtn.onClick.AddListener(()=>OnRestartPressed?.Invoke());
|
||||
pauseScreenView.restartBtn.onClick.AddListener(()=>OnRestartPressed?.Invoke());
|
||||
}
|
||||
|
||||
public void ShowPauseScreen()
|
||||
{
|
||||
pauseScreenView.Show();
|
||||
}
|
||||
|
||||
private void OnRestartButtonClicked()
|
||||
{
|
||||
Debug.Log("Restart Button Clicked");
|
||||
}
|
||||
|
||||
private void OnResumeButtonClicked()
|
||||
{
|
||||
Debug.Log("Resume Button Clicked");
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/PauseScreenController.cs.meta
Normal file
2
Assets/Scripts/UI/PauseScreenController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a02a1a48e230b5743b3aedb6b9dcf4e3
|
||||
19
Assets/Scripts/UI/PauseScreenView.cs
Normal file
19
Assets/Scripts/UI/PauseScreenView.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PauseScreenView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] public GameObject pauseScreen;
|
||||
public Button resumeBtn;
|
||||
public Button restartBtn;
|
||||
|
||||
public void Show()
|
||||
{
|
||||
pauseScreen.SetActive(true);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
pauseScreen.SetActive(false);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/PauseScreenView.cs.meta
Normal file
2
Assets/Scripts/UI/PauseScreenView.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9139af2b841ef584da86e7b387b494d5
|
||||
24
Assets/Scripts/UI/StartScreenController.cs
Normal file
24
Assets/Scripts/UI/StartScreenController.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
|
||||
public class StartScreenController
|
||||
{
|
||||
private StartScreenView startScreenView;
|
||||
public event Action OnStartPressed;
|
||||
public StartScreenController(StartScreenView _startScreenView)
|
||||
{
|
||||
Debug.Log("StartScreenController Constructor Called");
|
||||
startScreenView = _startScreenView;
|
||||
startScreenView.tapToStartButton.onClick.AddListener(() => OnStartPressed?.Invoke());
|
||||
}
|
||||
|
||||
private void OnTapToStartButtonClicked()
|
||||
{
|
||||
startScreenView.Hide();
|
||||
}
|
||||
public void ShowStartScreen()
|
||||
{
|
||||
startScreenView.Show();
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/StartScreenController.cs.meta
Normal file
2
Assets/Scripts/UI/StartScreenController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 940b62ceff11bbd498aab6bfc2cdeebe
|
||||
24
Assets/Scripts/UI/StartScreenView.cs
Normal file
24
Assets/Scripts/UI/StartScreenView.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class StartScreenView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject startScreen;
|
||||
public Button tapToStartButton;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
//startScreen.SetActive(true);
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
startScreen.SetActive(true);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
startScreen.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
2
Assets/Scripts/UI/StartScreenView.cs.meta
Normal file
2
Assets/Scripts/UI/StartScreenView.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e48dcf0a824cead4d8c1339c10b81b3b
|
||||
Reference in New Issue
Block a user