Added auto-portal script
This commit is contained in:
27
Assets/measuregeneric/scripts/Autoportal.cs
Normal file
27
Assets/measuregeneric/scripts/Autoportal.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Autoportal : MonoBehaviour
|
||||
{
|
||||
public GameObject imposter;
|
||||
|
||||
private OcclusionPortal portal;
|
||||
|
||||
void Start()
|
||||
{
|
||||
this.portal = this.GetComponent<OcclusionPortal>();
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
this.portal.open = true;
|
||||
this.imposter.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
this.portal.open = false;
|
||||
this.imposter.SetActive(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user