using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class TroopsPerSecond : MonoBehaviour { public Text troopText; public float troopAmount; public float troopIncreasedPerSecond; // Start is called before the first frame update void Start(){ troopAmount = 0f; troopIncreasedPerSecond = 10f; } // Update is called once per frame void Update(){ if (troopAmount < 50f){ troopAmount += troopIncreasedPerSecond * Time.deltaTime; troopText.text = troopAmount.ToString("F0"); } else{ print("Troops full"); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)