Exemplo n.º 1
0
    protected virtual void PopulateEnemies(int min, int max)
    {                   // code to be used until Garrett's class/method for providing an enemy object is in place
        //GameObject e = FindObjectOfType<AP_DungeonGenerator>().enemy;	// currently grabbing enemy object that I know dungeon generator has to instantiate
        int enemyAmount = Random.Range(min, max + 1);

        for (int i = 0; i < enemyAmount; i++)
        {
            GameObject enemy   = Instantiate(enemyGenerator.getEnemy());
            Collider2D roomCol = this.gameObject.GetComponent <Collider2D> ();
            enemy.GetComponent <Enemy> ().setRoom(roomCol);                                     // enemy objects want to have the collider of the room they belong to, so
            Set(enemy);                                                                         // they know the bounds they can wander
        }
    }