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

38 lines
897 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RoomTemplate : MonoBehaviour
{
public GameObject[] rightRooms;
public GameObject[] leftRooms;
public GameObject[] topRooms;
public GameObject[] downRooms;
public float waitTime;
private bool spawned = false;
public GameObject exitTraining;
public GameObject roomWithoutExit;
public List<GameObject> rooms;
void Update()
{
if(waitTime <= 0 && spawned == false)
{
for(int i=0; i<= rooms.Count; i++)
{
if(i == rooms.Count - 1)
{
Instantiate(exitTraining, rooms[i].transform.position, Quaternion.identity);
spawned = true;
}
}
}
else
{
waitTime -= Time.deltaTime;
}
}
}