public void Spawn(RoomInfo r) { room = r; templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <EnemyTemplates>(); if (r.type == "normal") { int numE = Random.Range(1, 4); for (int i = 0; i < numE; i++) { int xOffset = Random.Range(-1, 2); int yOffset = Random.Range(-1, 2); int rand = Random.Range(0, templates.enemies.Length); GameObject enemy = Instantiate(templates.enemies[rand], (Vector2)transform.position + new Vector2(xOffset, yOffset), Quaternion.identity); DamageableEntity de = enemy.GetComponent <DamageableEntity>(); if (de != null) { de.spawnlist = this; enemies.Add(de); } } } else if (r.type == "boss") { } }
void Start() { // itemTemplates contains all the different types of objects that can be spawned in a room enemyTemplates = GameObject.FindGameObjectWithTag("Enemies").GetComponent <EnemyTemplates>(); // Calls Spawn() every 0.1 seconds Invoke("Spawn", 0.1f); }
void Start() { Destroy(gameObject, waitTime); r = GetComponentInParent <Room>(); templates = GameObject.FindGameObjectWithTag("Enemies").GetComponent <EnemyTemplates>(); Invoke("Spawn", 0.1f); rand = Random.Range(1, 3); }
void Start() { templates = GameObject.FindGameObjectWithTag("EnemyTemplates").GetComponent <EnemyTemplates>(); float spawnDelay = 7f; Invoke("Spawn", spawnDelay); }
void Start() { playerDetected = false; templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>(); enemyTemp = GameObject.FindGameObjectWithTag("EnemyTemplate").GetComponent <EnemyTemplates>(); addroom = transform.parent.parent.parent.GetComponent <AddRoom>(); //reference to addroom script at base room // try { // eneSP = transform.parent.parent.parent.GetChild(3).gameObject; // } // catch (Exception e) { // print("error"); // } // eneSP = transform.parent.parent.parent.GetChild(3).gameObject; roomNum = addroom.roomNumber; }
public List <ICharacter> GenerateEnemies() { return(EnemyTemplates.GetRandomEncounter()); }