// Use this for initialization void Start() { cam = portal.portalCamera; cutoutMaterial = new Material(Shader.Find("Custom/ScreenCutout")); thisPortalRenderer = GetComponent <EpitaphRenderer>(); if (thisPortalRenderer == null) { thisPortalRenderer = gameObject.AddComponent <EpitaphRenderer>(); } GameObject volumetricPortal = portal.volumetricPortal; thisPortalVolumetricRenderer = volumetricPortal.GetComponent <EpitaphRenderer>(); if (thisPortalVolumetricRenderer == null) { thisPortalVolumetricRenderer = volumetricPortal.AddComponent <EpitaphRenderer>(); } CreateRenderTexture(EpitaphScreen.currentWidth, EpitaphScreen.currentHeight); }
void OnEnable() { initialLayer = gameObject.layer; thisRenderer = gameObject.GetComponent <EpitaphRenderer>(); if (thisRenderer == null) { thisRenderer = gameObject.AddComponent <EpitaphRenderer>(); } oppositeStartingVisibilityState = startingVisibilityState == VisibilityState_old.visible ? VisibilityState_old.invisible : VisibilityState_old.visible; if (!setMaterialColorOnStart && setMaterialColorOnStateChange) { Material startingMaterial = thisRenderer.GetMaterial(); materialColor = startingMaterial.GetColor(EpitaphRenderer.mainColor); emissiveColor = startingMaterial.GetColor(emissiveColorKey); } ObscurePillar.OnPlayerMoveAroundPillar += HandlePlayerMoveAroundPillar; ObscurePillar.OnActivePillarChanged += HandlePillarChanged; ObscurePillar.OnActivePillarChanged += ResetVisibilityStateIfPartiallyVisible; }