private void OnEnable() { distanceGrabbable = GetComponent <OculusSampleFramework.DistanceGrabbable>(); playerVision = GetComponentInChildren <Figurine_PlayerVision>(); figurineTransform = GetComponent <Transform>(); oldPos = figurineTransform.position; }
// Gets the components to be called, makes one initial update not to make the figurine stand in fog. private void OnEnable() { playerVision = GetComponentInChildren <Figurine_PlayerVision>(); // distanceGrabbable = GetComponent<OculusSampleFramework.DistanceGrabbable>(); // figTransform = GetComponent<Transform>(); // playerVision.ShouldUpdate(); }
// Makes any object that should not be visible by this camera invisible by changing their layer // right before the culling. private void OnPreCull() { // Get all temporarily and permanently known objects from each figurine owned by the player attached to this camera. foreach (GameObject playerFig in figs.GetOwnedFigurines()) { Figurine_PlayerVision playerVis = playerFig.GetComponentInChildren <Figurine_PlayerVision>(); tempKnownObjects.UnionWith(playerVis.GetTempKnownObjects()); permKnownObjects.UnionWith(playerVis.GetPermKnownObjects()); } // Makes all permanently known non-fog objects visible. foreach (GameObject go in permKnownObjects) { if (!go.CompareTag("Fog")) { if (go.CompareTag("Obstacle")) { go.transform.parent.gameObject.layer = defaultLayer; } else { go.layer = defaultLayer; } } } // Makes all temporarily known fog cells invisible and all other temporarily known objects visible. foreach (GameObject go in tempKnownObjects) { if (go.CompareTag("Fog")) { go.layer = invisibleLayer; } else { go.layer = defaultLayer; } } }