private void Start() { this.ProgressInGame.IsPlayerDead = false; this.RegisterEvents(); this.player = GameObject.FindGameObjectWithTag(Resources.Tags.Player); this.shipEngine = GameObject.FindGameObjectWithTag(Resources.Tags.Ship).GetComponent <ShipEngineScript>(); this.tasks = GameObject.FindGameObjectWithTag(Resources.Tags.Tasks); this.infoText = GameObject.FindGameObjectWithTag(Resources.Tags.InfoText); this.pauseMenu = GameObject.FindGameObjectWithTag(Resources.Tags.PauseMenu); this.pauseMenu.SetActive(false); this.repairSlider = GameObject.FindGameObjectWithTag(Resources.Tags.RepairSlider).GetComponent <Slider>(); this.repairSlider.gameObject.SetActive(false); Transform[] baseCommandersSpawnPoints = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.BaseCommanderSpawnPoint), item => item.transform); Transform[] commandersSpawnPoints = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.CommanderSpawnPoint), item => item.transform); Transform[] soldiersSpawnPoints = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.SoldierSpawnPoint), item => item.transform); Transform[] workersSpawnPoints = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.WorkerSpawnPoint), item => item.transform); this.ManageEnemies.SetSpawnPoints(baseCommandersSpawnPoints, commandersSpawnPoints, soldiersSpawnPoints, workersSpawnPoints); // load saved game or start new... this.ProgressInGame = (GameSaveLoad.LoadSavedGame ? GameSaveLoad.Load() : new GameProgress()); this.ReadGameProgress(GameSaveLoad.LoadSavedGame); }
private void Awake() { this.darkMatterModule = GameObject.FindGameObjectWithTag(Resources.Tags.DarkMatterModule); this.onPlayerHasDarkMatterModule = new UnityAction(this.OnPlayerHasDarkMatterModule); EventManager.On(Resources.Events.PlayerHasDarkMatterModule, this.onPlayerHasDarkMatterModule); this.onSpaceshipRepaired = new UnityAction(this.OnSpaceshipRepaired); EventManager.On(Resources.Events.SpaceshipRepaired, this.onSpaceshipRepaired); this.shipEngine = GameObject.FindGameObjectWithTag(Resources.Tags.Ship).GetComponent <ShipEngineScript>(); this.repairingSlider = GameObject.FindGameObjectWithTag(Resources.Tags.RepairSlider).GetComponent <Slider>(); }