Beispiel #1
0
    public void OnUpdate()
    {
        if (!activated || finished)
        {
            return;
        }

        float dt = FrameController.DT();

        if (isAlive)
        {
            currAliveTimer -= dt;
            faceTransform.LookAt(Common.GetStealthPlayer().transform.GetPosition(CTransform.TransformSpace.GLOBAL));
            if (currAliveTimer < 0.0f)
            {
                currAliveTimer = MMath.GetRandomLimitedFloat(_monsterMinActiveTime, _monsterMaxActiveTime);
                isAlive        = false;
                faceRender.setEnabled(false);
            }
        }
        else
        {
            currDeadTimer -= dt;

            if (currDeadTimer < 0.0f)
            {
                currDeadTimer = MMath.GetRandomLimitedFloat(_monsterMinRestTime, _monsterMaxRestTime);
                isAlive       = true;
                ActivateMonster();
                distortScript.Trigger();
            }
        }
    }
    public void TriggerColumnLights(uint col)
    {
        // deactivating flicker
        foreach (CLight obj in _allLights)
        {
            obj.setEnabled(true);
            //LightFlickerTemp script = GetScript<LightFlickerTemp>(obj.gameObject);
            //
            //if(script != null)
            //    script.activated = false;
        }
        flickeringLights.Clear();

        switch (col)
        {
        case 0:

            // Flicker on col 1


            // Flicker on col 3

            _col1Lights[MMath.GetRandomInt(0, _col1Lights.Count - 1)].setEnabled(false);

            _col3Lights[MMath.GetRandomInt(0, _col3Lights.Count - 1)].setEnabled(false);
            break;


        case 1:

            // Flicker on col 0

            // Flicker on col 2

            _col0Lights[MMath.GetRandomInt(0, _col0Lights.Count - 1)].setEnabled(false);

            _col2Lights[MMath.GetRandomInt(0, _col2Lights.Count - 1)].setEnabled(false);

            break;

        case 2:

            // Flicker on col 3
            //flickeringLights.Add(_col3Lights[ MMath.GetRandomInt(0, _col3Lights.Count - 1) ] );
            // Flicker on col 0
            //flickeringLights.Add(_col0Lights[ MMath.GetRandomInt(0, _col0Lights.Count - 1) ] );
            _col3Lights[MMath.GetRandomInt(0, _col3Lights.Count - 1)].setEnabled(false);

            _col0Lights[MMath.GetRandomInt(0, _col0Lights.Count - 1)].setEnabled(false);
            break;

        case 3:

            // Flicker on col 1
            //flickeringLights.Add(_col1Lights[ MMath.GetRandomInt(0, _col1Lights.Count - 1) ] );
            // Flicker on col 2


            _col1Lights[MMath.GetRandomInt(0, _col1Lights.Count - 1)].setEnabled(false);

            _col2Lights[MMath.GetRandomInt(0, _col2Lights.Count - 1)].setEnabled(false);
            break;
        }

        foreach (CLight obj in flickeringLights)
        {
            obj.setEnabled(false);
            //LightFlickerTemp script = GetScript<LightFlickerTemp>(obj.gameObject);
            //if (script != null)
            //    script.activated = true;
        }
        distortScript.Trigger();
    }