// Use this for initialization
	void Start () 
	{
		waveManager = GameObject.Find("WaveManager").GetComponent<HeroWaveManager>();
		waveGUIManager = GameObject.Find("WaveGUIManager").GetComponent<WaveGUIManager>();
		
		monsterSpawners = GameObject.FindGameObjectsWithTag("MonsterSpawner");
		
		particleManager = GameObject.Find("ParticleManager").GetComponent<ParticleManager>();
		
		pausedSpawners = new List<MonsterSpawner>(8);
		
		pauseSprite = GameObject.Find("PauseToggleButton").GetComponent<tk2dSprite>();
	}
	void Awake()
	{		
		spawners = new Dictionary<string, HeroSpawner>();
		
		waves = new List<Wave>(8);
		currWave = 0;				//We're not on any wave yet!
		timeSinceLastSpawn = 0.0f;  //We haven't had anything spawn yet!
		timeUntilNextSpawn  = 0.0f; 
		
		//Locate all of the spawners and store them and their names into a Dictionary.
		GameObject[] spawnerObjects = GameObject.FindGameObjectsWithTag("Spawner");
		
		foreach (GameObject spawnerObject in spawnerObjects)
			spawners.Add(spawnerObject.name, spawnerObject.GetComponent<HeroSpawner>());	
		
		//Link up with the managers we need.
		waveGUIManager = GameObject.Find("WaveGUIManager").GetComponent<WaveGUIManager>();
		waveGUIManager.onStartWaveButtonPressed += HandleOnStartWaveButtonPressed;
		
		partyManager = GameObject.Find("PartyManager").GetComponent<HeroPartyManager>();
		
		entityFactory = EntityFactory.GetInstance();
		
		waveState = WaveState.WaitingToStartWave;
		setupNextWave = true;
	}