Merge branch 'main' into clement

This commit is contained in:
Crizomb 2025-01-28 23:01:44 +01:00
commit 9c9c895319
14 changed files with 2098 additions and 111 deletions

40
Assets/Scripts/GameUI.cs Normal file
View 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();
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 24e4c78ff3d5523409c311e513ba6ce4

32
Assets/Scripts/LoseUI.cs Normal file
View 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);
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5393cb13d8a7330418334d35a76e6da1

View file

@ -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;
}
}

View 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);
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 77dd5b557ccc843469e1ecb32d50884e