예제 #1
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            // if(other.CompareTag("SpawnPoint") && other.GetComponent<RoomSpawner>().spawned == true){
            //     print("destroy");
            //     Destroy(transform.gameObject);
            // }

            if (other.CompareTag("SpawnPoint"))
            {
                if (other.GetComponent <RoomSpawner>().spawned == false && spawned == false)
                {
                    templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
                    Instantiate(templates.closedRoom, transform.position, Quaternion.identity);
                    Destroy(gameObject);
                }
                spawned = true;
            }
        }
예제 #2
0
 private void Start()
 {
     templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     templates.rooms.Add(this.gameObject);
 }
예제 #3
0
 private void Start()
 {
     Destroy(gameObject, waitTime);
     templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     Invoke("Spawn", 0.1f);
 }