Merge branch 'main' into clement
This commit is contained in:
commit
9c9c895319
14 changed files with 2098 additions and 111 deletions
40
Assets/Scripts/GameUI.cs
Normal file
40
Assets/Scripts/GameUI.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] TextMeshProUGUI timer;
|
||||
public float time;
|
||||
public bool timerActive;
|
||||
|
||||
[SerializeField] TextMeshProUGUI units;
|
||||
private int enemiesLeft;
|
||||
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
time = 0;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (timerActive)
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
}
|
||||
|
||||
TimeSpan displayedTime = TimeSpan.FromSeconds(time);
|
||||
|
||||
timer.text = displayedTime.Minutes.ToString() + displayedTime.Seconds.ToString();
|
||||
|
||||
|
||||
enemiesLeft = GlobalsVariable.AliveUnitsTeamA.Count;
|
||||
units.text = "Units Left: " + enemiesLeft.ToString();
|
||||
}
|
||||
|
||||
|
||||
}
|
2
Assets/Scripts/GameUI.cs.meta
Normal file
2
Assets/Scripts/GameUI.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 24e4c78ff3d5523409c311e513ba6ce4
|
32
Assets/Scripts/LoseUI.cs
Normal file
32
Assets/Scripts/LoseUI.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class LoseUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameUI gameUI;
|
||||
|
||||
[SerializeField] TextMeshProUGUI time;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
time.text = gameUI.GetComponent<GameUI>().time.ToString();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Retry()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name);
|
||||
}
|
||||
|
||||
public void MainMenu()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(0);
|
||||
}
|
||||
}
|
2
Assets/Scripts/LoseUI.cs.meta
Normal file
2
Assets/Scripts/LoseUI.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5393cb13d8a7330418334d35a76e6da1
|
|
@ -10,6 +10,12 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
|
|||
[SerializeField] private List<string> levelMusics;
|
||||
[SerializeField] private List<int> levelsMoney;
|
||||
int current_level = -1;
|
||||
|
||||
[SerializeField] GameObject GameUI;
|
||||
[SerializeField] GameObject LoseUI;
|
||||
[SerializeField] GameObject WinUI;
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
@ -64,4 +70,11 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
|
|||
|
||||
}
|
||||
|
||||
public void Losing()
|
||||
{
|
||||
|
||||
LoseUI.SetActive(true);
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
22
Assets/Scripts/WinCanvas.cs
Normal file
22
Assets/Scripts/WinCanvas.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class WinCanvas : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void NextLevel()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex + 1);
|
||||
}
|
||||
}
|
2
Assets/Scripts/WinCanvas.cs.meta
Normal file
2
Assets/Scripts/WinCanvas.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 77dd5b557ccc843469e1ecb32d50884e
|
Loading…
Add table
Add a link
Reference in a new issue