Example #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 OnUpdate()
    {
        if (!alive)
        {
            return;
        }

        currAliveTimer -= FrameController.DT();
        if (currAliveTimer < 0.0f)
        {
            faceRender.setEnabled(false);
            alive = false;
        }
        faceTransform.LookAt(Common.GetStealthPlayer().transform.GetPosition(CTransform.TransformSpace.GLOBAL));
    }