add: deployment

This commit is contained in:
KOSMOGOR
2025-03-30 19:17:13 +03:00
parent 787c2329ad
commit 4dbdb71145
97 changed files with 67770 additions and 9 deletions
+10
View File
@@ -0,0 +1,10 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class DeployController : MonoBehaviour
{
public void Deploy(string sceneName) {
LevelInfo level = GameController.i.GetLevel(sceneName);
SceneManager.LoadScene(level.scene.name);
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5d8fb9491704815bdb79ab6c30216589
+20 -5
View File
@@ -14,22 +14,37 @@ public class GameController : MonoBehaviour
DontDestroyOnLoad(gameObject);
}
public Dictionary<Enemy, int> PopEnemies(string sceneName) {
public Dictionary<GameObject, int> PopEnemies(string sceneName) {
LevelInfo li = levels.Find(x => x.scene.name == sceneName);
Dictionary<Enemy, int> enemies = li.enemies;
Dictionary<GameObject, int> enemies = li.enemies;
li.enemies.Clear();
return enemies;
}
public void AddEnemyInLevel(Enemy enemy, string sceneName) {
Dictionary<Enemy, int> enemies = levels.Find(x => x.scene.name == sceneName).enemies;
public void AddEnemyInLevel(GameObject enemy, string sceneName) {
Dictionary<GameObject, int> enemies = levels.Find(x => x.scene.name == sceneName).enemies;
if (enemies.ContainsKey(enemy)) enemies[enemy] += 1;
else enemies[enemy] = 1;
}
public LevelInfo GetLevel(string sceneName) {
return levels.Find(x => x.scene.name == sceneName);
}
}
[Serializable]
public class LevelInfo {
public SceneAsset scene;
public Dictionary<Enemy, int> enemies;
public int hp;
public int maxHp;
public FactoryType factory;
public Dictionary<GameObject, int> enemies;
}
public enum FactoryType {
None,
Rifle,
Rocket,
Minigun,
Railgun
}
+1 -1
View File
@@ -7,6 +7,6 @@ public class LevelController : MonoBehaviour
public List<Transform> spawnPoints;
public void Start() {
Dictionary<Enemy, int> enemies = GameController.i.PopEnemies(SceneManager.GetActiveScene().name);
Dictionary<GameObject, int> enemies = GameController.i.PopEnemies(SceneManager.GetActiveScene().name);
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ public class PlayerMovement : MonoBehaviour
void Start() {
characterController = GetComponent<CharacterController>();
ground = GetComponent<GroundDetector>();
ground = GetComponentInChildren<GroundDetector>();
}
void Update() {