next level logic

This commit is contained in:
Crizomb 2025-01-28 04:11:53 +01:00
parent ee2a5fdf08
commit 37bed1fd33
16 changed files with 130 additions and 38 deletions

View file

@ -1,8 +1,14 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
{
[SerializeField] private List<string> levelNames;
int current_level = 0;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
@ -15,6 +21,7 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
// Delete, use only for Debug
if (Input.GetKeyDown(KeyCode.Space))
{
print("OOKOKOKOKOKOK");
StartFightForAll();
}
}
@ -27,5 +34,19 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
unit.StartFight();
}
}
public void GoNextLevel()
{
if (current_level < levelNames.Count)
{
current_level++;
SceneManager.LoadScene(levelNames[current_level]);
return;
}
throw new Exception("Bro there is no next level like stop pls");
}
}