This commit is contained in:
Kirabsol 2025-01-28 20:31:35 +01:00
commit 0e815e1a05
18 changed files with 32090 additions and 26395 deletions

View file

@ -23,6 +23,6 @@ public class CameraMouvement : MonoBehaviour
void Update()
{
var mouvement = moveSpeed * Time.deltaTime * (new Vector3(_moveInput.y, 0, -_moveInput.x));
transform.Translate(mouvement, Space.World);
transform.Translate(transform.TransformVector(mouvement), Space.World);
}
}

View file

@ -7,8 +7,8 @@ using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
{
[SerializeField] private List<string> levelNames;
int current_level = 0;
[SerializeField] private List<int> levelsMoney;
int current_level = -1;
[SerializeField] GameObject GameUI;
[SerializeField] GameObject LoseUI;
@ -18,7 +18,7 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
GoNextLevel();
}
// Update is called once per frame
@ -39,15 +39,30 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
unit.StartFight();
}
}
private void SetGlobals(int current_level)
{
GlobalsVariable.AliveUnitsTeamB = new List<AbstractUnit>();
GlobalsVariable.AliveUnitsTeamA = new List<AbstractUnit>();
GlobalsVariable.QueenA = null;
GlobalsVariable.QueenB = null;
GlobalsVariable.money = levelsMoney[current_level];
}
public void ReloadLevel()
{
print("get good, reload current scene");
SetGlobals(current_level);
SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name);
}
public void GoNextLevel()
{
if (current_level < levelNames.Count)
{
current_level++;
SetGlobals(current_level);
SceneManager.LoadScene(levelNames[current_level]);
return;
}
throw new Exception("Bro there is no next level like stop pls");

View file

@ -52,13 +52,10 @@ public class HealthHandler : MonoBehaviour
return;
}
GlobalsVariable.AliveUnitsTeamB = new List<AbstractUnit>();
GlobalsVariable.AliveUnitsTeamA = new List<AbstractUnit>();
if (deathState == DeathSate.QueenBDead)
{
print("get good, reload current scene");
SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name);
GameManager.Instance.ReloadLevel();
}
if (deathState == DeathSate.QueenADead)

View file

@ -31,6 +31,14 @@ public class MinecraftUnit : AbstractUnit
if (IsQueen)
{
transform.Find("Crown").gameObject.SetActive(true);
if (IsTeamA)
{
GlobalsVariable.QueenA = this;
}
else
{
GlobalsVariable.QueenB = this;
}
}
}