Advertisement
Placido_GDD

MVC RoomTemplates

Jan 14th, 2022
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class RoomTemplates : MonoBehaviour
  6. {
  7.     public GameObject[] bottomRooms;
  8.     public GameObject[] topRooms;
  9.     public GameObject[] leftRooms;
  10.     public GameObject[] rightRooms;
  11.  
  12.     public GameObject ClosedRoom;
  13.     public List<GameObject> rooms;
  14.  
  15.     public float waitTime;
  16.     private bool spawnedBoss;
  17.     public GameObject boss;
  18.  
  19.     void Update()
  20.     {
  21.         if (waitTime <= 0 && spawnedBoss == false)
  22.         {
  23.             for (int i = 0; i < rooms.Count; i++)
  24.             {
  25.                 if (i == rooms.Count - 1)
  26.                 {
  27.                     Instantiate(boss,rooms[i].transform.position, Quaternion.identity);
  28.                     spawnedBoss = true;
  29.                 }
  30.             }
  31.         }
  32.         else if(spawnedBoss == false)
  33.         {
  34.             waitTime -= Time.deltaTime;
  35.         }
  36.     }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement