42 lines
879 B
C#
42 lines
879 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Autoportal : MonoBehaviour
|
|
{
|
|
private List<GameObject> imposters;
|
|
|
|
private OcclusionPortal portal;
|
|
|
|
void Start()
|
|
{
|
|
this.portal = this.GetComponent<OcclusionPortal>();
|
|
this.imposters = new List<GameObject>();
|
|
|
|
foreach(Transform child in this.transform)
|
|
{
|
|
this.imposters.Add(child.gameObject);
|
|
}
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
this.portal.open = true;
|
|
|
|
foreach(GameObject imposter in this.imposters)
|
|
{
|
|
imposter.SetActive(false);
|
|
}
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
this.portal.open = false;
|
|
|
|
foreach(GameObject imposter in this.imposters)
|
|
{
|
|
imposter.SetActive(true);
|
|
}
|
|
}
|
|
}
|