Added Auto Occlusion Portal
This commit is contained in:
46
Assets/measuregeneric/scripts/Autoportal.cs
Normal file
46
Assets/measuregeneric/scripts/Autoportal.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Autoportal : MonoBehaviour
|
||||
{
|
||||
public GameObject imposter;
|
||||
|
||||
private List<GameObject> imposters;
|
||||
|
||||
private OcclusionPortal portal;
|
||||
|
||||
void Start()
|
||||
{
|
||||
this.portal = this.GetComponent<OcclusionPortal>();
|
||||
// this.imposter = this.transform.GetChild(0).gameObject;
|
||||
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;
|
||||
// this.imposter.SetActive(false);
|
||||
|
||||
foreach(GameObject imposter in this.imposters)
|
||||
{
|
||||
imposter.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
this.portal.open = false;
|
||||
// this.imposter.SetActive(true);
|
||||
|
||||
foreach(GameObject imposter in this.imposters)
|
||||
{
|
||||
imposter.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/measuregeneric/scripts/Autoportal.cs.meta
Normal file
11
Assets/measuregeneric/scripts/Autoportal.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16d3e87d2e756fb4484fef8f0e8526aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user