Some fixes and better code
This commit is contained in:
@@ -21,32 +21,33 @@ public class Areaportal : UdonSharpBehaviour
|
||||
foreach(Transform child in this.transform)
|
||||
{
|
||||
this.imposters[i++] = child.gameObject;
|
||||
child.gameObject.SetActive(!this.portal.open);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPortalOpenState(bool state)
|
||||
{
|
||||
this.portal.open = state;
|
||||
|
||||
foreach(GameObject imposter in this.imposters)
|
||||
{
|
||||
imposter.SetActive(!state);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPlayerTriggerEnter(VRCPlayerApi player)
|
||||
{
|
||||
if (!(player.IsValid() && player.isLocal))
|
||||
return;
|
||||
|
||||
this.portal.open = true;
|
||||
|
||||
foreach(GameObject imposter in this.imposters)
|
||||
if (player.IsValid() && player.isLocal)
|
||||
{
|
||||
imposter.SetActive(false);
|
||||
this.SetPortalOpenState(true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPlayerTriggerExit(VRCPlayerApi player)
|
||||
{
|
||||
if (!(player.IsValid() && player.isLocal))
|
||||
return;
|
||||
|
||||
this.portal.open = false;
|
||||
|
||||
foreach(GameObject imposter in this.imposters)
|
||||
if (player.IsValid() && player.isLocal)
|
||||
{
|
||||
imposter.SetActive(true);
|
||||
this.SetPortalOpenState(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user