Files
KOSMOGOR 85dc2955cf add: you can't deploy to destroyed levels
add: levels now have bulletsGenerate
update: levels have different factories
2025-04-30 20:53:58 +03:00

30 lines
828 B
C#

using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class DeployButton : MonoBehaviour
{
public TMP_Text textField;
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() {
dc.Deploy(levelName);
}
public void SetLevelInfoText() {
LevelInfo levelInfo = GameController.i.GetLevel(levelName);
string s = $"HP: {levelInfo.hp}/{levelInfo.maxHp}\nEnemies: {levelInfo.enemies.Values.Sum(x => x)}\nBullet type: {GameController.GetBulletTypeString(levelInfo.factory)}";
textField.text = s;
}
}