Retroactive refactoring
This commit is contained in:
@@ -1,31 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class Autoportal : MonoBehaviour
|
||||
{
|
||||
private List<GameObject> imposters;
|
||||
private Transform[] 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);
|
||||
}
|
||||
this.imposters = Array.FindAll(GetComponentsInChildren<Transform>(), child => child != this.transform);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
this.portal.open = true;
|
||||
|
||||
foreach(GameObject imposter in this.imposters)
|
||||
foreach(Transform imposter in this.imposters)
|
||||
{
|
||||
imposter.SetActive(false);
|
||||
imposter.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +27,9 @@ public class Autoportal : MonoBehaviour
|
||||
{
|
||||
this.portal.open = false;
|
||||
|
||||
foreach(GameObject imposter in this.imposters)
|
||||
foreach(Transform imposter in this.imposters)
|
||||
{
|
||||
imposter.SetActive(true);
|
||||
imposter.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user