public static void resetReferencesForNewLevel() { // Managers manager = GameObject.FindGameObjectWithTag("Manager"); stateManager = manager.GetComponent<StateManager>(); stateTiming = manager.GetComponent<StateTiming>(); // Game stats and information gameStats = manager.GetComponent<GameStats>(); itemDatabase = manager.GetComponent<Item_Database>(); inventory = manager.GetComponent<Inventory>(); market = manager.GetComponent<Market>(); marketArrays = manager.GetComponent<MarketArrays>(); soundEffects = GameObject.FindObjectOfType<SoundEffectsDatabase>().GetComponent<SoundEffectsDatabase>(); // Cameras realtimeCamera = GameObject.FindGameObjectWithTag("Camera_Realtime").GetComponent<Camera>(); strategicCamera = GameObject.FindGameObjectWithTag("Camera_Strategic").GetComponent<Camera>(); // Game entities player = GameObject.FindGameObjectWithTag("Player"); castle = GameObject.FindGameObjectWithTag("Castle"); soundEffect = (GameObject)Resources.Load("OneTimeSoundEffect", typeof(GameObject)); // Data lastLevelIndex = Application.loadedLevel; currentLevel = 1; }
void Start() { stateTiming = References.stateTiming; References.stateManager.changeState += checkSpawnEnemy; References.stateManager.nextLevel += nextLevel; spawnEnemies(5); }