Heroes_of_Hiis/Assets/BossSpawner.cs

29 lines
699 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BossSpawner : MonoBehaviour
{
[SerializeField]
private GameObject bossSlime;
[SerializeField]
private Transform spawnLocation;
[SerializeField]
private int maxAmount = 1;
public void SpawnBossSlime()
{
int alive = GameObject.FindGameObjectsWithTag("BossSlime").Length;
if (alive <= maxAmount)
{
bossSlime.transform.localScale = new Vector3(5, 5, 5);
Instantiate(bossSlime, spawnLocation.position, Quaternion.identity);
}
else
{
Debug.LogWarning("Max bosses in scene");
}
}
}