//deploy your methods here private MainController() { userGameData = new UserGameData(); userGameData.Init(); enemyGameData = new EnemyGameData(); enemyGameData.Init(); }
private IEnumerator generateMoney(EnemyGameData gameData) { if (isSetGenerateMoney) { yield return new WaitForSeconds(4f); gameData.money = gameData.money + gameData.generatingMoney; StartCoroutine(generateMoney(gameData)); } }
private IEnumerator setMoneyGenerationDiff(EnemyGameData gameData) { int generatingMoney = gameData.teritoryCount; GameObject[] bases = GameObject.FindGameObjectsWithTag("enemyBase"); foreach (GameObject obj in bases) { GameObject objectMain = obj.transform.parent.gameObject; EnemyMainBase mainBase = (EnemyMainBase) objectMain.GetComponent("EnemyMainBase"); generatingMoney -= mainBase.generatingUnits; generatingMoney -= 5; } gameData.generatingMoney = generatingMoney; yield return null; StartCoroutine(setMoneyGenerationDiff(gameData)); }
public void startGenerateMoney(EnemyGameData gameData) { isSetGenerateMoney = true; StartCoroutine(generateMoney(gameData)); StartCoroutine(setMoneyGenerationDiff(gameData)); }