void Spawn() { if (spawned == false) { if (openingDirection == 1) { room = templates.tr(this.gameObject); } else if (openingDirection == 2) { room = templates.rr(this.gameObject); } else if (openingDirection == 3) { room = templates.br(this.gameObject); } else if (openingDirection == 4) { room = templates.lr(this.gameObject); } Instantiate(room, transform.position, room.transform.rotation); rooms++; spawned = true; } }