public void OpenCoffin() { if (isOpen) { return; } render.sprite = coffinOpen; coffinSound.Play(); //Spawn baddie if (enemyTemplateToSpawn != null) { GameObject enemy = Instantiate(enemyTemplateToSpawn, MapUnit.CurrentTile.transform.position, Quaternion.identity); TurnTaker turnTaker = enemy.GetComponent <TurnTaker>(); if (turnTaker != null) { TurnManager turns = FindObjectOfType <TurnManager>(); turns.AddTurnTaker(enemy.GetComponent <TurnTaker>()); } } isOpen = true; }
public void SpawnAmbush() { TurnManager turns = FindObjectOfType <TurnManager>(); foreach (GameObject spawn in AmbushSpawnPoints) { Enemy enemy = Instantiate(enemySpawnTemplate, spawn.transform.position, Quaternion.identity); TurnTaker turnTaker = enemy.GetComponent <TurnTaker>(); if (turnTaker != null) { turns.AddTurnTaker(enemy.GetComponent <TurnTaker>()); } } }