add: you can't deploy to destroyed levels

add: levels now have bulletsGenerate
update: levels have different factories
This commit is contained in:
KOSMOGOR
2025-04-30 20:53:58 +03:00
parent 68cf00fd21
commit 85dc2955cf
6 changed files with 80 additions and 23 deletions
+4
View File
@@ -1,6 +1,7 @@
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class DeployButton : MonoBehaviour
{
@@ -8,9 +9,12 @@ public class DeployButton : MonoBehaviour
public string levelName;
DeployController dc;
Button button;
void Start() {
dc = FindFirstObjectByType<DeployController>();
button = GetComponent<Button>();
if (GameController.i.IsLevelDestroyed(levelName)) button.interactable = false;
}
public void DeployFromButton() {
+1
View File
@@ -11,6 +11,7 @@ public class DeployController : MonoBehaviour
public void Deploy(string sceneName) {
LevelInfo level = GameController.i.GetLevel(sceneName);
if (GameController.i.IsLevelDestroyed(sceneName)) return;
SceneManager.LoadScene(level.sceneName);
}
+2 -1
View File
@@ -77,7 +77,7 @@ public class GameController : MonoBehaviour
void AddBullets() {
levels.ForEach(li => {
if (!IsLevelDestroyed(li.sceneName) && li.factory != BulletType.None) inventory[li.factory] += 10;
if (!IsLevelDestroyed(li.sceneName) && li.factory != BulletType.None) inventory[li.factory] += li.bulletsGenerate;
});
}
@@ -148,6 +148,7 @@ public struct LevelInfo {
public int hp;
public int maxHp;
public BulletType factory;
public int bulletsGenerate;
public Dictionary<GameObject, int> enemies;
}