Exemplo n.º 1
0
 private void HandlePillarVisibilityChange(VisibilityState_old newState)
 {
     if (newState == VisibilityState_old.visible)
     {
         ObscurePillar.activePillar = this;
     }
 }
        public void SetVisibilityState(VisibilityState_old newState)
        {
            visibilityState = newState;
            UpdateVisibilitySettings();

            if (OnVisibilityStateChange != null)
            {
                OnVisibilityStateChange(newState);
            }
        }
        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;
        }