added gamescreen UI and simple start menu
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using Darkmatter.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Darkmatter.Presentation
|
||||
{
|
||||
public class GameScreenController : IGameScreenController
|
||||
{
|
||||
GameScreenView gameScreenView;
|
||||
|
||||
public GameScreenController(GameScreenView gameScreenView)
|
||||
{
|
||||
this.gameScreenView = gameScreenView;
|
||||
}
|
||||
public void UpdateFireableBulletCount(int bulletCount)
|
||||
{
|
||||
gameScreenView.UpdateBulletText(bulletCount);
|
||||
}
|
||||
|
||||
public void UpdateRemainingZombiesCount(int zombiesCount)
|
||||
{
|
||||
gameScreenView.UpdateRemainingZombiesCountText(zombiesCount);
|
||||
}
|
||||
|
||||
public void UpdateTotalZombiesCount(int totalZombiesCount)
|
||||
{
|
||||
gameScreenView.UpdateTotalZombiesCount(totalZombiesCount);
|
||||
}
|
||||
|
||||
public void ShowGameOverText()
|
||||
{
|
||||
gameScreenView.ShowGameOver();
|
||||
|
||||
}
|
||||
|
||||
public void ShowPlayerHealth(int health)
|
||||
{
|
||||
gameScreenView.ShowPlayerHealth(health);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7143025033c7d9840a214fb5c4bfefb9
|
||||
45
Assets/Darkmatter/Code/Presentation/UI/GameScreenView.cs
Normal file
45
Assets/Darkmatter/Code/Presentation/UI/GameScreenView.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Darkmatter.Presentation
|
||||
{
|
||||
public class GameScreenView : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI fireableBulletText;
|
||||
public TextMeshProUGUI remainingZombiesCountText;
|
||||
public TextMeshProUGUI totalZombiesCountText;
|
||||
public TextMeshProUGUI playerHealthText;
|
||||
public GameObject GameOverObject;
|
||||
|
||||
public void UpdateBulletText(int bulletCount)
|
||||
{
|
||||
fireableBulletText.text = bulletCount.ToString();
|
||||
}
|
||||
|
||||
public void UpdateRemainingZombiesCountText(int zombiesCount)
|
||||
{
|
||||
remainingZombiesCountText.text = zombiesCount.ToString();
|
||||
}
|
||||
|
||||
public void UpdateTotalZombiesCount(int totalZombies)
|
||||
{
|
||||
totalZombiesCountText.text = totalZombies.ToString();
|
||||
}
|
||||
public void ShowPlayerHealth(int health)
|
||||
{
|
||||
playerHealthText.text = health.ToString();
|
||||
}
|
||||
public void ShowGameOver()
|
||||
{
|
||||
GameOverObject.SetActive(true);
|
||||
Invoke("ChangeScene", 2f);
|
||||
}
|
||||
|
||||
void ChangeScene()
|
||||
{
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53b791085ea93e74eb91492d67fa02a6
|
||||
@@ -5,6 +5,10 @@ namespace Darkmatter.Presentation
|
||||
{
|
||||
public class MenuScreen : MonoBehaviour
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
}
|
||||
public void OnPlayBtnClick()
|
||||
{
|
||||
SceneManager.LoadScene(1);
|
||||
|
||||
Reference in New Issue
Block a user