public void OnUpdate()
    {
        float dt = FrameController.DT();

        if (isActivated) // Start scripted monster moving and disappearing and light controlled flicker
        {
            scriptTimer -= dt;

            Vector3 glassToPlayer = (Vector3)Common.GetStealthPlayer().transform.position - (Vector3)gameObject.transform.position;
            float   distZ         = Vector3.Dot(glassToPlayer, mDirectionToRun); // distance player is from trigger
            float   distX         = Vector3.Dot(glassToPlayer, mDirectionTowardGlass);

            switch (scriptedState)
            {
            case 0:
                // As player walks towards glass, turn on more lights to flicker
                if (distX > 5.0f)
                {
                    StartLightFlicker(2, true);
                    ++scriptedState;
                }
                break;

            case 1:
                if (distX > 11.0f)
                {
                    // after some time,
                    StartLightFlicker(1, true); // nearer to monster
                    // Play sound at monster position
                    mSound.PlayIndependentEventStatic3D("C1_ANGRY.vente", monsterInitPos, false);

                    scriptTimer = 0.8f;
                    ++scriptedState;
                }
                break;

            case 2:
                if (scriptTimer <= 0.0f)
                {
                    StartLightFlicker(0, true); // shows the monster
                    scriptTimer = 1.2f;
                    ++scriptedState;
                }
                break;

            case 3:
                if (scriptTimer <= 0.0f)
                {
                    StartLightFlicker(4, true); // first light along corridor
                    scriptTimer = 0.6f;
                    ++scriptedState;
                }
                break;

            case 4:
                if (scriptTimer <= 0.0f)
                {
                    StartLightFlicker(5, true); // second light along corridor
                    scriptTimer = 1.0f;
                    ++scriptedState;
                }
                break;

            case 5:
                if (scriptTimer <= 0.0f)
                {
                    Logger.Log("Happening");
                    StartLightFlicker(0, false);
                    StartLightFlicker(1, false);
                    scriptTimer = 1.0f;
                    ++scriptedState;
                }
                break;

            case 6:// This is when player should be running towards hub
                if (distZ > 4.0f)
                {
                    StartLightFlicker(3, false);
                    StartLightFlicker(2, false);
                    StartLightFlicker(1, false);
                    scriptTimer = 1.0f;
                    ++scriptedState;
                }
                break;

            case 7:
                if (scriptTimer <= 0.0f)
                {
                    StartLightFlicker(0, false);
                    scriptTimer = 1.0f;
                    ++scriptedState;
                }
                break;

            case 8:

                break;
            }

            // As player walks to run, turn off lights behind

            /*
             #if ZERO
             * if (scriptTimer <= 0.0f && scriptedState <= 6)
             * {
             * switch (scriptedState)
             * {
             * case 0: // 0 - turn off
             * flickeringLight.SetAtt(0.0f);
             * flickeringLight2.SetAtt(0.3f);
             * scriptTimer = timer0;
             * break;
             * case 1: // 1 - monster in front
             * {
             * float xPos = glass.transform.position.x - monsterInitPos.X;
             * xPos = monsterInitPos.X + xPos * 0.65f; // Halfway towards the glass
             * Vector3 newPos = monsterInitPos;
             * newPos.X = xPos;
             * monster.transform.SetPosition(newPos);
             *
             * flickeringLight.SetAtt(originalIntensity);
             * allowFlickering = true;
             * timer = 0.1f;
             * scriptTimer = timer1;
             * break;
             * }
             * case 2: // 2 - turn off
             * flickeringLight.SetAtt(0.0f);
             * monster.transform.SetPosition(monsterInitPos);
             *
             * allowFlickering = false;
             * scriptTimer = timer2;
             * break;
             * case 3: // 3 - monster back with flickering
             * flickeringLight2.SetAtt(originalIntensity);
             * allowFlickering = true;
             * scriptTimer = timer3;
             * break;
             * case 4: // 4 - turn off
             * {
             * flickeringLight.SetAtt(0.0f);
             * flickeringLight2.SetAtt(0.3f);
             *
             * allowFlickering = false;
             * scriptTimer = timer4;
             * break;
             * }
             * case 5: // 5 - monster at glass with flickering
             * {
             * float xPos = glass.transform.position.x - monsterInitPos.X;
             * xPos = monsterInitPos.X + xPos * 0.9f; // At the glass
             * Vector3 newPos = monsterInitPos;
             * newPos.X = xPos;
             * newPos.Z = glass.transform.position.z;
             * monster.transform.SetPosition(newPos);
             *
             * allowFlickering = true;
             * break;
             * }
             * }
             ++scriptedState; // Move on to the next stage
             * }
             #endif
             */
        }
    }