示例#1
0
 new void Update()
 {
     if (state == 0)
     {
         if (!isWaitingForActionToComplete)
         {
             level.storeBoolValue("PlayerMustMaterialize", true);
             level.storeStringValue("ReturnLocation", targetWorld);
             level.loadScene("TransWorldTunnel");
         }
     }
 }
示例#2
0
    new void Update()
    {
        if (state == 0)
        {
            return;
        }

        if (state == 1)
        {
            if (isWaitingForActionToComplete)
            {
                return;
            }
            level.loadScene(destination);
        }
    }
示例#3
0
    new void Update()
    {
        if (state == 0)
        {
            return;
        }

        if (state == 1)
        {
            if (isWaitingForActionToComplete)
            {
                return;
            }
            level.storeStringValue("GroundType", "");
            level.loadScene(destination);
        }
    }
    new void Update()
    {
        if (exit == false)
        {
            return;
        }
        if (isWaitingForActionToComplete)
        {
            return;
        }

        if (framesElapsed == 0)
        {
            //cameraGrab.grab ();
            Graphics.Blit(whiteTex, rt);
        }
        framesElapsed++;
        if (framesElapsed == 3)
        {
            string returnLocation = level.retrieveStringValue("ReturnLocation");
            level.loadScene(returnLocation);
        }
    }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        float ySize;


        /* slot 1 */
        if (state2 == 0)           // idle

        {
        }
        if (state2 == 1)           // delay
        {
            slot1elapsedTime += Time.deltaTime;
            if (slot1elapsedTime > looseScreenDelay)
            {
                ++state2;
            }
        }
        if (state2 == 2)
        {
            level.loadScene("LevelOver");
        }
        /* end of slot 1 */



        /* slot 0 */
        if ((globalStep == 0) && (state2 == 0))
        {
            state2 = 1;
            level.musicFadeOut();
            fader.fadeOut();
        }
        if (state == LetterState.idle)           // We set target1col&target2op Here
        {
            if (globalStep < globalTargetStep)   // need to go UP!

            {
                if (step == (substeps - 1))
                {
                    setColorOpacityTargets(0);
                    opacity = 1.0f;
                    state   = LetterState.fadingOutScrollingUp;
                }
                else
                {
                    setColorOpacityTargets(step + 1);
                    state = LetterState.steppingUp;
                }
            }
            else if (globalStep > globalTargetStep)                 // need to go DOWN!

            {
                if (step == 0)
                {
                    setColorOpacityTargets(substeps - 1);
                    opacity = 1.0f;
                    state   = LetterState.fadingOutScrollingDown;
                }
                else
                {
                    setColorOpacityTargets(step - 1);
                    state = LetterState.steppingDown;
                }
            }
            else
            {
                if (idleElapsedTime < idleMaxTime)
                {
                    idleElapsedTime += Time.deltaTime;
                    if (idleElapsedTime > idleMaxTime)
                    {
                        targetGlobalOpacity = 0.0f;
                    }
                }
            }
        }


        if (state == LetterState.fadingInScrollingDown)           // when a letter disappears and the next
        // appears

        {
            opacity += opacitySpeed * Time.deltaTime;
            if (opacity > 1.0f)
            {
                --globalStep;
                step    = getStep(globalStep);
                state   = LetterState.idle;
                opacity = 1.0f;
            }

            //letter1.color = new Color (1.0f, 1.0f, 1.0f, opacity);
            //letter2.color = new Color (1.0f, 1.0f, 1.0f, opacity);
            letter1color   = opacity;
            letter2opacity = opacity;
        }

        if (state == LetterState.fadingOutScrollingDown)
        {
            opacity -= opacitySpeed * Time.deltaTime;
            if (opacity < 0.0f)
            {
                state = LetterState.fadingInScrollingDown;
                --letterNum;
                opacity         = 0.0f;
                letter1.color   = new Color(1.0f, 1.0f, 1.0f, opacity);
                letter2.color   = new Color(1.0f, 1.0f, 1.0f, opacity);
                letter1.texture = letter [letterNum];                 // change letter
                letter2.texture = litLetter [letterNum];
            }
            float percent = (1.0f / (substeps / 2));
            //letter1.color = new Color (percent, percent, percent, opacity);
            ////letter2.color = new Color (1.0f, 1.0f, 1.0f, opacity);
            letter1color   = opacity * percent;
            letter2opacity = 0.0f;
        }

        if (state == LetterState.fadingInScrollingUp)           // when a letter disappears and the next
        // appears

        {
            opacity += opacitySpeed * Time.deltaTime;
            if (opacity > 1.0f)
            {
                ++globalStep;
                step  = getStep(globalStep);
                state = LetterState.idle;
            }
            float percent = (1.0f / ((float)substeps / 2.0f));
            letter1color   = percent;
            letter2opacity = 0.0f;
            //letter1.color = new Color (percent, percent, percent, opacity);
            //letter2.color = new Color (0, 0, 0, 0);
        }

        if (state == LetterState.fadingOutScrollingUp)
        {
            opacity -= opacitySpeed * Time.deltaTime;
            if (opacity < 0.0f)
            {
                state = LetterState.fadingInScrollingUp;
                ++letterNum;
                opacity = 0.0f;
                //letter1.color = new Color (1.0f, 1.0f, 1.0f, opacity);
                //letter2.color = new Color (1.0f, 1.0f, 1.0f, opacity);
                letter1.texture = letter [letterNum];                 // change letter
                letter2.texture = litLetter [letterNum];
            }
            //letter1.color = new Color (1.0f, 1.0f, 1.0f, opacity);
            //letter2.color = new Color (1.0f, 1.0f, 1.0f, opacity);
            letter1color   = opacity;
            letter2opacity = opacity;
        }

        if (state == LetterState.steppingUp)
        {
            if (letter1color < targetColor)
            {
                letter1color += changeSpeed * Time.deltaTime;
                if (letter1color > targetColor)
                {
                    letter1color = targetColor;
                    ++globalStep;
                    step  = getStep(globalStep);
                    state = LetterState.idle;
                }
            }
            if (letter2opacity < targetOpacity)
            {
                letter2opacity += changeSpeed * Time.deltaTime;
                if (letter2opacity > targetOpacity)
                {
                    letter2opacity = targetOpacity;
                    ++globalStep;
                    step  = getStep(globalStep);
                    state = LetterState.idle;
                }
            }
        }

        if (state == LetterState.steppingDown)
        {
            if (letter1color > targetColor)
            {
                letter1color -= changeSpeed * Time.deltaTime;
                if (letter1color < targetColor)
                {
                    letter1color = targetColor;
                    --globalStep;
                    step  = getStep(globalStep);
                    state = LetterState.idle;
                }
            }
            if (letter2opacity > targetOpacity)
            {
                letter2opacity -= changeSpeed * Time.deltaTime;
                if (letter2opacity < targetOpacity)
                {
                    letter2opacity = targetOpacity;
                    --globalStep;
                    step  = getStep(globalStep);
                    state = LetterState.idle;
                }
            }
        }

        letter1.color = new Color(letter1color, letter1color, letter1color, letter1color * globalOpacity);
        letter2.color = new Color(1, 1, 1, letter2opacity * globalOpacity);
        frame.color   = new Color(1, 1, 1, globalOpacity);

        if (globalOpacity < targetGlobalOpacity)
        {
            globalOpacity += opacitySpeed * 2.0f * Time.deltaTime;
            if (globalOpacity > targetGlobalOpacity)
            {
                globalOpacity = targetGlobalOpacity;
            }
        }
        if (globalOpacity > targetGlobalOpacity)
        {
            globalOpacity -= opacitySpeed * 2.0f * Time.deltaTime;
            if (globalOpacity < targetGlobalOpacity)
            {
                globalOpacity = targetGlobalOpacity;
            }
        }
        /* end of slot 0 */
    }
示例#6
0
	new void Update () 
	{
        if(meditatingRemaining > 0.0f)
        {
            meditatingRemaining -= Time.deltaTime;
            return;
        }

        if (remainingBlinks > 0) // orthogonal blinking state
        {
            remainingBlinkTime -= Time.deltaTime;
            if(remainingBlinkTime <= 0.0f)
            {
                BlinkShow = !BlinkShow;
                remainingBlinkTime = 0.08f;
                --remainingBlinks;
                if(remainingBlinks == 0)
                {
                    BlinkShow = true;
                }
                spriteQuadRef.GetComponent<SpriteRenderer>().enabled = BlinkShow;
            }
        }

        if (mustSnapToPlayerStart > 0) {
			if (GameObject.Find ("PlayerStart")) 
			{
				Vector3 newPos = GameObject.Find ("PlayerStart").transform.position;
				this.transform.position = newPos;
			}
			mustSnapToPlayerStart--;
		}

		if (!started)
			return;
		if (state == PlayerState.idling) 

		{
			materializated = true;
		}

		if (state2 == PlayerState.enteringMirror) 
		{			
			lerp += Time.deltaTime;
			if (lerp > 1.0f) 
			{
				lerp = 1.0f;					
			}
			if (blink) {
				spriteQuadRef.GetComponent<SpriteRenderer> ().enabled = false;
				mirroredPlayer.gameObject.SetActive(false);
			} else {
				spriteQuadRef.GetComponent<SpriteRenderer> ().enabled = true;
				mirroredPlayer.gameObject.SetActive(true);
			}

			blink = !blink;
			Vector3 pos = Vector3.Lerp (enterMirrorStartPosition, enterMirrorPosition, lerp);
			this.transform.position = pos;
			this.transform.localScale = new Vector3 (1.0f - lerp, 1.0f - lerp, 1.0f - lerp);
			mirroredPlayer.transform.localScale = this.transform.localScale;
		}
		if (mirrorActivationDelaying) 
		{ // Reentry condition: showing mirror activation
			if (elapsedTime > mirrorActivationDelay) {
				ds.storeStringValue ("ReentryCondition", "");
				string returnLocation = ds.retrieveStringValue ("ReturnLocation");
				SceneManager.LoadScene (returnLocation);
			}
			return;
		}

		if (state2 == PlayerState.seekingMirrorPoint1) 
		{
			if((agent.remainingDistance < 0.25f) && agent.velocity.magnitude == 0) 
			{	
				Vector3 target = agent.destination + new Vector3 (0, 0, 0.25f);
				agent.destination = target;
				elapsedTime = 0.0f;
				directionFromVector (target, false);
				state2 = PlayerState.seekingMirrorPoint2;
				camRef.GetComponent<CameraUtils>().grab();

			}
		}

		if (state2 == PlayerState.seekingMirrorPoint2) 
		{
			elapsedTime += Time.deltaTime;
			if (elapsedTime > 9.0f) {
				SceneManager.LoadScene("Scenes/WordFight");
			}
		}

		if (state == PlayerState.dematerialized) 
		{
			++dematDelayFrames;

			blockedElapsedTime += Time.deltaTime;

			if (blockedElapsedTime > dematerializationDelay) {
				blockedElapsedTime = 0.0f;
				state = PlayerState.materializing;
				GameObject AuraGO = (GameObject)Instantiate (auraPrefab, 
					this.transform.position + new Vector3(0, 0.16f, -0.5f), 
					Quaternion.Euler (0, 0, 0));
				levelRef.playSound (matSound);
			} else
				return;
		}

		if (state == PlayerState.materializing) 
		{
			blockedElapsedTime += Time.deltaTime;
			float newOpacity = elapsedTime / materializationDuration;
			if (newOpacity > 1.0f)
				newOpacity = 1.0f;
			iTween.ColorUpdate(spriteQuadRef, new Color (1, 1, 1, 1), 4);

			if (blockedElapsedTime > materializationDuration) 
			{
				blockedElapsedTime = 0.0f;
				playerMatRef.color = new Color (1, 1, 1, 1);
				state = PlayerState.idling;
				blocked = false;
				ds.storeBoolValue ("PlayerMustMaterialize", false);
				materializated = true;
			}
		}

		if (Input.GetMouseButtonDown(0) && interaction != Interaction.None) 
		{
			contador = 1;
		}

		if (Input.GetMouseButton (0)) 
		{
			contador += Time.deltaTime;
		}

		if (!blocked && Input.GetMouseButtonUp (0)) 
		{
			if (!canInteract) {
				if (canOpenInventory) {
					if (contador < 0.5f) {
						Ray ray = camRef.ScreenPointToRay (Input.mousePosition);
						//Physics.RaycastAll (ray, out hit);

						RaycastHit[] hits;
						hits = Physics.RaycastAll (ray, 2000);
						for (int i = 0; i < hits.Length; i++) {
							RaycastHit hit = hits [i];

							if (hit.collider != null) {
								if (hit.collider.tag == "Player") {
									blockControls ();
									//inventory._wm_open ();
									inventory.open (1);
								}
							}
						}
					}
				}
			}
			contador = 0;
		}

		if (state2 == PlayerState.spinning) 
		{
			angle += angleSpeed * Time.deltaTime;
			angleSpeed += angleAccel * Time.deltaTime;
			if (angleSpeed > maxAngleSpeed)
				angleSpeed = maxAngleSpeed;
			directionFromAngle (angle);
			playerRendRef.sprite = images [0];
			otherPlayerRendRef.sprite = images [0];
			if (angle > angleThreshold) {
				state2 = PlayerState.spinning2;
				elapsedTime = 0.0f;
				frame = 0;
			}
		}

		if (state2 == PlayerState.spinning2) 
		{
			elapsedTime += Time.deltaTime;
			if (elapsedTime > (1.0f / descendingAnimationSpeed)) {

				if (frame < Descending.Length) {
					frame++;
					elapsedTime = 0.0f;
				} else {
					//levelRef.fadeout (this);
					//this.isWaitingForActionToComplete = true;
					camRef.GetComponent<CameraUtils>().grab();
					mcsRef.getStorage ().storeBoolValue ("IsChangingPlanes", true);
					setOrientation (0);
					idlePose ();
					state2 = PlayerState.spinning3;
					return;
				}
			}
		}

		if (state2 == PlayerState.spinning3)
		{
			//if (isWaitingForActionToComplete)
			//	return;
			string loc = levelRef.lowerFloorName;
			mcsRef.getStorage().storeBoolValue ("InhibitVignette", true);
			mcsRef.getStorage ().storeFloatValue ("Coords" + loc + "X", this.transform.position.x);
			mcsRef.getStorage ().storeFloatValue ("Coords" + loc + "Y", this.transform.position.y);
			mcsRef.getStorage ().storeFloatValue ("Coords" + loc + "Z", this.transform.position.z);
			mcsRef.getStorage ().storeFloatValue ("Coords" + levelRef.lowerFloorName + "X", this.transform.position.x);
			mcsRef.getStorage ().storeFloatValue ("Coords" + levelRef.lowerFloorName + "Y", this.transform.position.y);
			mcsRef.getStorage ().storeFloatValue ("Coords" + levelRef.lowerFloorName + "Z", this.transform.position.z);
			mcsRef.getStorage().storeIntValue ("Orientation", 0);
			SceneManager.LoadScene (levelRef.lowerFloorName);
		}

		if (state2 == PlayerState.ascending) 
		{
			elapsedTime += Time.deltaTime;
			state2 = PlayerState.ascending2;
//			if (elapsedTime > (1.0f / ascendingAnimationSpeed)) {
//				elapsedTime = 0.0f;
//				if (meditationFrame < Ascending.Length) {
//					//playerRendRef.sprite = Ascending [meditationFrame];
//					//otherPlayerRendRef.sprite = Ascending [meditationFrame++];
//				} else {
//					state2 = PlayerState.ascending2;
//					ascendPos = 0.0f;
//					ascendSpeed = 0.0f;
//					ascendStartPos = spriteQuadRef.transform.localPosition;
//				}
//			}
		}

		if (state2 == PlayerState.ascending2) 
		{
			//Vector3 newPos = new Vector3 (ascendStartPos.x, ascendStartPos.y + ascendPos, ascendStartPos.z);
			ascendPos += ascendSpeed * Time.deltaTime;
			ascendSpeed += ascendAccel * Time.deltaTime;
			//spriteQuadRef.transform.localPosition = newPos;
			if ((ascendPos > 90.0f) && !grabbedFrame) {
				camRef.GetComponent<CameraUtils> ().grab ();
				mcsRef.getStorage ().storeBoolValue ("IsChangingPlanes", true);
				mcsRef.getStorage().storeBoolValue ("InhibitVignette", true);
				grabbedFrame = true;
				//levelRef.fadeout ();
			}
			if(ascendPos > 100.0f) {
				string loc = levelRef.upperFloorName;
//				mcsRef.getStorage ().storeFloatValue ("Coords" + loc + "X", this.transform.position.x);
//				mcsRef.getStorage ().storeFloatValue ("Coords" + loc + "Y", this.transform.position.y);
//				mcsRef.getStorage ().storeFloatValue ("Coords" + loc + "Z", this.transform.position.z);
				mcsRef.getStorage ().storeFloatValue ("Coords" + levelRef.upperFloorName + "X", this.transform.position.x);
				mcsRef.getStorage ().storeFloatValue ("Coords" + levelRef.upperFloorName + "Y", this.transform.position.y);
				mcsRef.getStorage ().storeFloatValue ("Coords" + levelRef.upperFloorName + "Z", this.transform.position.z);

				//levelRef.storePhysicalCameraPosition (levelRef.upperFloorName);

//				ds.storeFloatValue ("Pos" + loc + "X", cam.gameObject.transform.position.x);
//				ds.storeFloatValue ("Pos" + loc + "Y", cam.gameObject.transform.position.y);
//				ds.storeFloatValue ("Pos" + loc + "Z", cam.gameObject.transform.position.z);
//				ds.storeFloatValue ("Rot" + loc + "Y", cam.pivotY.transform.localEulerAngles.y);
//				ds.storeFloatValue ("Rot" + loc + "X", cam.pivotX.transform.localEulerAngles.x);
//				ds.storeFloatValue ("PosIn" + loc + "Z", cam.pivotZ.transform.localPosition.z);

				//ds.storeFloatValue ("PosIn" + loc + "M", cam.mainCamera.transform.localPosition.z);
				//SceneManager.LoadScene (levelRef.upperFloorName);
				levelRef.loadScene(levelRef.upperFloorName);
			}
		}

		if (state2 == PlayerState.spawningShadow1)
		{
			blockedElapsedTime = 0.0f;
			state2 = PlayerState.spawningShadow2; 
		}

		if (state2 == PlayerState.spawningShadow2) 
		{
			blockedElapsedTime += Time.deltaTime;
			if(blockedElapsedTime > 1.0f) { // WARNING constantize
				blockedElapsedTime = 0.0f;
				blinkRemainingTime = 0.0f;
				state2 = PlayerState.spawningShadow3;
			}
		}

		if (state2 == PlayerState.spawningShadow3)
		{
			blockedElapsedTime += Time.deltaTime;

			if (blockedElapsedTime > 1f) 
			{
				if (blocked) 
				{
					unblockControls ();
				}
			}

			if (blockedElapsedTime > blinkingTime) {
				blockedElapsedTime = 0.0f;
				state2 = PlayerState.spawningShadow4;
				spriteQuadRef.GetComponent<SpriteRenderer> ().enabled = true;
			}
			blinkRemainingTime += Time.deltaTime;
			if (blinkRemainingTime > (1.0f / shadowBlinkAnimationSpeed)) {
				blinkRemainingTime = 0.0f;
				blink = !blink;
				if (blink)
					spriteQuadRef.GetComponent<SpriteRenderer> ().enabled = false;
				else
					spriteQuadRef.GetComponent<SpriteRenderer> ().enabled = true;
			}
		}

		if (state2 == PlayerState.spawningShadow4) 
		{
			spriteQuadRef.GetComponent<SpriteRenderer> ().enabled = true;
			state = PlayerState.idling;
			state2 = PlayerState.idling;
			iNetRef.frozen = false;
		}

		spawningShadowElapsedTime += Time.deltaTime;

		if (isWaitingForActionToComplete)
			return;
	}
示例#7
0
    new void Update()
    {
        if (autopilotState == PlayerAutopilotState.idle)
        {
        }
        if (autopilotState == PlayerAutopilotState.seeking1)
        {
            if (!isWaitingForActionToComplete)
            {
                //hGlow.glow ();
                //player._wa_autopilotTo (this, this.transform.position - new Vector3 (0, 0, 5.02f));
                player.setOrientation(4);                 // looking back
                autopilotState = PlayerAutopilotState.seeking2;
            }
        }
        if (autopilotState == PlayerAutopilotState.seeking2)
        {
            if (!isWaitingForActionToComplete)
            {
                if (hGlow != null)
                {
                    hGlow.glow();
                }
                if (energyBurstPrefab != null)                   // if mirror is light mirror

                {
                    HeroReflection.GetComponent <Renderer> ().material.mainTexture = HeroImage;
                    HeroReflection.GetComponent <Renderer> ().enabled = true;
                    HeroReflection.GetComponent <TextureFader> ().fadeIn();
                    //camManager.moveRelative (new Vector3(0, -0.3f, 8.0f));
                    player.blockControls();
                    autopilotState = PlayerAutopilotState.waitingForBurst;
                    GameObject go = (GameObject)Instantiate(energyBurstPrefab, this.gameObject.transform.position, Quaternion.Euler(0, 0, 0));
                    energyBurst          = go.GetComponent <MirrorHeroEnergyBurst> ();
                    energyBurst.mirrorGO = this.gameObject;
                    energyBurst.playerGO = player.gameObject;
                    ParticleSystem s = go.GetComponent <ParticleSystem> ();
                    s.startColor = new Color(color.r, color.g, color.b, 1.0f);
                    energyBurst.initialize();
                    energyBurst._wm_go();
                    this.GetComponent <SphereCollider> ().center = Vector3.down * 200;
                    this.state           = MirrorState.deactivated;
                    this.interactEnabled = false;
                    deactivate();
                    substate = 0;
                    //animAux.Break (); not yet
                }

                else                   // if mirror is dark mirror
                {
                    player.blockControls();
                    spawnControl.callShadows(this.transform.position);
                    autopilotState = PlayerAutopilotState.seeking3;
                    elapsedTime    = 0.0f;
                }
            }
        }
        if (autopilotState == PlayerAutopilotState.waitingForBurst)
        {
            if (substate == 0)
            {
                if (energyBurst != null && energyBurst.state > 2)
                {
                    //player.unblockControls ();
                    Destroy(energyBurst.gameObject);
                    if (hGlow != null)
                    {
                        hGlow.glow();
                    }
                    camManager.moveToOriginalPosition();
                    HeroReflection.GetComponent <TextureFader> ().fadeOut();
                    //autopilotState = PlayerAutopilotState.idle;
                    ++substate;

                    elapsedTime = 0.0f;
                }
            }

            if (substate == 1)
            {
                elapsedTime += Time.deltaTime;
                if (elapsedTime > 2.0f)
                {
                    ++substate;
                    //HeroReflection.GetComponent<Renderer> ().enabled = false;
                    //this.GetComponent<SphereCollider> ().enabled = false;
                    animAux.Break();
                    string lvl = level.locationName.Substring(0, 6);
                    ds.storeBoolValue(lvl + MirrorColor + "MirrorDepleted", true);
                    //ds.storeBoolValue ("CurrentLevelHasHero" + HeroType, true);
                    ds.storeBoolValue("Has" + lvl + HeroType, true);
                    ds.storeBoolValue("Has" + lvl + HeroType + (indexHero - 1), true);
                    ds.storeIntValue("Has" + lvl + HeroType, indexHero - 1);
                    elapsedTime = 0.0f;
                }
            }
            if (substate == 2)
            {
                elapsedTime += Time.deltaTime;
                if (elapsedTime > 2.0f)
                {
                    if (NewHeroProgram != null)
                    {
                        NewHeroProgram.startProgram(0);
                    }
                    else
                    {
                        player.unblockControls();
                    }
                    autopilotState = PlayerAutopilotState.idle;
                    level.mcRef.saveGame(true);
                }
            }
        }
        if (autopilotState == PlayerAutopilotState.seeking3)
        {
            elapsedTime += Time.deltaTime;
            if (elapsedTime > 12.0f)
            {
                player.enterMirror();
                elapsedTime    = 0.0f;
                autopilotState = PlayerAutopilotState.seeking4;
            }
        }

        if (autopilotState == PlayerAutopilotState.seeking4)
        {
            elapsedTime += Time.deltaTime;
            if (elapsedTime > 1.9f && !grabbingFrame)
            {
                level.grabFrame();
                grabbingFrame = true;
            }
            if (elapsedTime > 2.0f)
            {
                level.storeStringValue("ReturnLocation", level.locationName);
                level.storeStringValue("CurrentMirror", level.locationName + "DarkMirrorActivated");
                level.storeStringValue("CurrentLevel", level.locationName);
                level.loadScene("WordFight");
            }
        }

        if (state == MirrorState.deactivated)
        {
            interactEnabled = false;
            glowMat.SetColor("_TintColor", new Color(0, 0, 0, 0));
        }

        if (state == MirrorState.activating)
        {
            elapsedTime += Time.deltaTime;
            if (elapsedTime > initialDelay)
            {
                state       = MirrorState.activated;
                elapsedTime = 0.0f;
            }
        }

        if (state == MirrorState.activated)
        {
            elapsedTime += Time.deltaTime;

            glowMat.SetColor("_TintColor", new Color(color.r, color.g, color.b, opacity * (1.0f + Mathf.Cos(tremoloAngle) / 12.0f)));

            tremoloAngle += tremoloAngleSpeed * Time.deltaTime;

            if (opacity < 0.19f)
            {
                opacity += opacitySpeed * Time.deltaTime;
            }

            light.intensity = 0.5f + 0.5f * Mathf.Sin(elapsedTime * angleSpeed);
            mat.SetColor("_EmissionColor", color * light.intensity / 8.0f);
        }
    }