private void CreateGameUI(bool load) { gameUIController = Instantiate(Resources.Load <GameUIController>(GameUIModule.GameData.GAMEUICANVAS_PATH)); gameUIController.Init(PlanetModule.GameData.PLANET_MAX_HEALTH, mainRocketType); gameUIController.onClickRocketButton += mainPlanetController.Attack; mainPlanetController.OnHealthChanged += gameUIController.ChangeHealth; if (load) { gameUIController.ChangeHealth(saveData.Main.Health); } for (int i = 0; i < bots.Count; i++) { gameUIController.AddBotHealth(i, bots[i].GetCharacterParameters().Health); bots[i].OnChangeHealth += gameUIController.ChangeBotHealth; if (load) { gameUIController.ChangeBotHealth(i, saveData.Bots[i].Health); } } }
// Have to be invoked public void Init() { gameUIController.Init(); spawner = GameObject.Instantiate(Resources.Load <Spawner>(GameData.SPAWNER_PREFAB_PATH)); groupController = GameObject.Instantiate(Resources.Load <GroupController>(GameData.GROUP_CONTROLLER_PREFAB_PATH)); }