add: you can't deploy to destroyed levels
add: levels now have bulletsGenerate update: levels have different factories
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user