private void Awake() { if (GameObject.FindGameObjectsWithTag("GAME_HANDLER").Length > 1) { if (debug) { Debug.Log("There is more then one Game Handler. Removing excessive."); } Destroy(gameObject); } else { DontDestroyOnLoad(gameObject); GameState.Initiate(startingState); InputController.Initiate(); EnergyHandler.Initiate(); SoundMechanicHandler.Initiate(); LevelHandler.Initiate(); PrefabHolder.Initiate( heatArea, soundElement, energyBullet, energyLaser, energyDetectionVisualization, mainMixer ); SceneManager.sceneLoaded += CollectLevelProperties; } }
private void Return() { LevelHandler.GetPlayer().GetComponent <Player.PlayerController>().EnergyAmount += Energy; EnergyHandler.RemoveEnergyObject(this); Debug.Log("Returning Energy to player"); Destroy(gameObject); }
public void UpdateField() { ResizeArea(); UpdateParticleSystem(); if (Energy <= 0) { EnergyHandler.RemoveEnergyObject(this); Destroy(gameObject); } }
public static void Initiate() { instance = new EnergyHandler(); }