Pracownia-Programowania-Pro.../Assets/Scripts/DungeonGen/EnemySpawner.cs
Polarjad 68f6116689 Added map gen
Added enemy spawn, door spawn and despawn
2021-01-18 16:04:50 +01:00

27 lines
621 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemySpawner : MonoBehaviour
{
public GameObject enemy;
private SpawnTrigger spawn;
public GameObject trigger;
private bool spawned = false;
void Start()
{
spawn = trigger.GetComponent<SpawnTrigger>();
}
void Update()
{
if (spawn.playerTrigger == true && spawned == false)
{
Debug.Log("ENEMY SPAWN");
Instantiate(enemy, transform.position, transform.rotation);
spawned = true;
Destroy(gameObject);
}
}
}