private void ClearGameProgress() { currentLvl = 0; currentGold = 0; unitCredits = null; currentBattleLogicController = null; currentBattleUiController = null; waitingForBattleLevelLoad = false; }
private void SetUpNewBattle() { BattleLogicController battleLogicController = Instantiate(battleLogicControllerPrefab).GetComponent <BattleLogicController>(); BattleUIController battleUiController = Instantiate(battleUIControllerPrefab).GetComponent <BattleUIController>(); currentBattleLogicController = battleLogicController; currentBattleUiController = battleUiController; battleUiController.Initialize(currentBattleLogicController, unitCredits, levelConfigurations[currentLvl - 1]); battleLogicController.Initialize(currentBattleUiController, unitCredits); waitingForBattleLevelLoad = false; }
public void Initialize(BattleLogicController battleLogicController, Dictionary <UnitType, int> unitCredits, LevelConfiguration levelConfiguration) { var unitCreatorGO = Instantiate(unitCreatorPrefab); unitCreator = unitCreatorGO.GetComponent <UnitCreator>(); unitCreator.Initialize(); unitCreator.unitCreateEvent += OnUnitCreation; playerBar = GameObject.FindGameObjectWithTag("PlayerBar").GetComponent <ArmyBar>(); enemyBar = GameObject.FindGameObjectWithTag("EnemyBar").GetComponent <ArmyBar>(); SetUpButtons(unitCredits); winScreen = GameObject.FindGameObjectWithTag("WinCondition"); loseScreen = GameObject.FindGameObjectWithTag("LoseCondition"); this.battleLogicController = battleLogicController; this.levelConfiguration = levelConfiguration; }