private void Awake() { Instance = this; foreach (Room room in rooms) { room.OnRoomEnter += PrepareRoom; } foreach (EnemyData enemy in enemiesToSpawn) { enemyDataPair.Add(enemy.enemyPrefab, enemy); } }
void Start() { activateButtons(); plants = new List <GameObject>(); plants.Add(null); plants.Add((GameObject)Resources.Load("Producer")); plants.Add((GameObject)Resources.Load("Shooter")); plants.Add((GameObject)Resources.Load("Blocker")); plants.Add((GameObject)Resources.Load("Eater")); plants.Add((GameObject)Resources.Load("DoubleShooter")); Vector3 previewLocation = new Vector3(-4f, -4f, 0f); previews = new List <GameObject> (); previews.Add(null); previews.Add((GameObject)Instantiate(Resources.Load("ProducerPreview"), previewLocation, Quaternion.identity)); previews.Add((GameObject)Instantiate(Resources.Load("ShooterPreview"), previewLocation, Quaternion.identity)); previews.Add((GameObject)Instantiate(Resources.Load("BlockerPreview"), previewLocation, Quaternion.identity)); previews.Add((GameObject)Instantiate(Resources.Load("EaterPreview"), previewLocation, Quaternion.identity)); previews.Add((GameObject)Instantiate(Resources.Load("DoubleShooterPreview"), previewLocation, Quaternion.identity)); director = gameObject.GetComponent <SpawnDirector> (); ResourceManager.reset(); clickfx = gameObject.GetComponent <AudioSource>(); }
// Use this for initialization void Start() { activateButtons (); plants = new List<GameObject>(); plants.Add(null); plants.Add ((GameObject)Resources.Load("Producer")); plants.Add ((GameObject)Resources.Load("Shooter")); plants.Add ((GameObject)Resources.Load("Blocker")); plants.Add ((GameObject)Resources.Load("Eater")); plants.Add ((GameObject)Resources.Load("DoubleShooter")); Vector3 previewLocation = new Vector3 (-4f, -4f, 0f); previews = new List<GameObject> (); previews.Add (null); previews.Add ((GameObject)Instantiate(Resources.Load("ProducerPreview"),previewLocation, Quaternion.identity)); previews.Add ((GameObject)Instantiate(Resources.Load("ShooterPreview"),previewLocation, Quaternion.identity)); previews.Add ((GameObject)Instantiate(Resources.Load("BlockerPreview"),previewLocation, Quaternion.identity)); previews.Add ((GameObject)Instantiate(Resources.Load("EaterPreview"),previewLocation, Quaternion.identity)); previews.Add ((GameObject)Instantiate(Resources.Load("DoubleShooterPreview"),previewLocation, Quaternion.identity)); director = gameObject.GetComponent<SpawnDirector> (); ResourceManager.reset (); clickfx = gameObject.GetComponent<AudioSource>(); }