public void OnStart()
    {
        foreach (GameObject obj in GameObject.GetGameObjectsWithTag("col0"))
        {
            _col0Lights.Add(obj.RequireComponent <CLight>());
            _allLights.Add(obj.RequireComponent <CLight>());
        }
        foreach (GameObject obj in GameObject.GetGameObjectsWithTag("col1"))
        {
            _col1Lights.Add(obj.RequireComponent <CLight>());
            _allLights.Add(obj.RequireComponent <CLight>());
        }
        foreach (GameObject obj in GameObject.GetGameObjectsWithTag("col2"))
        {
            _col2Lights.Add(obj.RequireComponent <CLight>());
            _allLights.Add(obj.RequireComponent <CLight>());
        }
        foreach (GameObject obj in GameObject.GetGameObjectsWithTag("col3"))
        {
            _col3Lights.Add(obj.RequireComponent <CLight>());
            _allLights.Add(obj.RequireComponent <CLight>());
        }

        chilloutFace  = GameObject.GetGameObjectByName("lastchilloutface");
        faceRender    = chilloutFace.RequireComponent <CSkinMeshRenderer>();
        faceTransform = chilloutFace.RequireComponent <CTransform>();
        faceRender.setEnabled(false);

        distortScript = GetScript <DistortForTime>(gameObject);

        currAliveTimer = MMath.GetRandomLimitedFloat(_monsterMinActiveTime, _monsterMaxActiveTime);

        sound = gameObject.RequireComponent <CSound>();
    }
示例#2
0
    public Vector3 GetRandomPosition()
    {
        float x = MMath.GetRandomLimitedFloat(minX, maxX);
        float z = MMath.GetRandomLimitedFloat(minZ, maxZ);

        return(new Vector3(x, y, z));
    }
示例#3
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();
            }
        }
    }
示例#4
0
    public void S_LightOff_Start()
    {
        mTargetIntensity = MMath.GetRandomLimitedFloat(_minoffinten, _maxoffinten);
        mBeginInten      = light.mIntensity;

        lighthold.NextState      = lighton;
        lighthold.MaxTimeInState = MMath.GetRandomLimitedFloat(_minOnHoldTime, _maxOnHoldTime);
    }
示例#5
0
    public void S_LightOn_Start()
    {
        mTargetIntensity = MMath.GetRandomLimitedFloat(MinOnIntensity, MaxOnIntensity);
        mBeginInten      = light.mIntensity;

        lighthold.NextState      = lightoff;
        lighthold.MaxTimeInState = MMath.GetRandomLimitedFloat(MinOffHoldTime, MaxOffHoldTime);
    }
    void State_Reset_Start()
    {
        sound.PlayIndependentEvent("C1_PAIN.vente", false, 2);

        //turn off the mesh and move him away
        //cmesh.setEnabled(false);
        gameObject.transform.SetPosition(0, -100, 0);
        Logger.Log("Monster3 has reset");

        resetting.MaxTimeInState = MMath.GetRandomLimitedFloat(18.0f, 30.0f);
    }
示例#7
0
    public static float GetMovementZFloat()
    {
        if (MMath.GetRandomInt(0, 500) == 5)
        {
            mz_orient = !mz_orient;
        }

        if (mz_orient == false)
        {
            return(MMath.GetRandomLimitedFloat(-1.0f, 0.0f));
        }
        return(MMath.GetRandomLimitedFloat(0.0f, 1.0f));
    }
    public void TriggerMonster(Vector3 spawn)
    {
        faceTransform.SetPositionX(spawn.X);
        faceTransform.SetPositionZ(spawn.Z);
        //faceTransform.LookAt(Common.GetStealthPlayer().transform.GetPosition(CTransform.TransformSpace.GLOBAL));
        faceRender.setEnabled(true);

        alive = true;

        currAliveTimer = MMath.GetRandomLimitedFloat(_monsterMinActiveTime, _monsterMaxActiveTime);

        sound.PlayIndependentEvent("C1_LAUGH", false, 1);
    }
示例#9
0
    public void OnStart()
    {
        //base.OnStart();
        currAliveTimer = MMath.GetRandomLimitedFloat(_monsterMinActiveTime, _monsterMaxActiveTime);
        currDeadTimer  = MMath.GetRandomLimitedFloat(_monsterMinRestTime, _monsterMaxRestTime);

        chilloutFace  = GameObject.GetGameObjectByName("maxChill");
        faceRender    = chilloutFace.RequireComponent <CSkinMeshRenderer>();
        faceTransform = chilloutFace.RequireComponent <CTransform>();
        faceRender.setEnabled(false);

        distortScript = GetScript <DistortForTime>(gameObject);
    }
示例#10
0
    public void OnUpdate()
    {
        float dt = FrameController.DT();

        if (hasConsoleTextChanged == 2)
        {
            const float minTimeForEachCharacter = 0.01f;
            const float maxTimeForEachCharacter = 0.07f;
            eachCharTimer -= dt;
            if (eachCharTimer <= 0.0f)
            {
                eachCharTimer = MMath.GetRandomLimitedFloat(minTimeForEachCharacter, maxTimeForEachCharacter);
                if (currTextIndexDisplayed >= firstLineTextToDisplay.Length) // Finished typing all messages
                {
                    UpdateAllTextImmediately();
                }
                else
                {
                    String textLeft = GrabOneCharFromString(firstLineTextToDisplay, currTextIndexDisplayed);
                    if (textLeft == " ")
                    {
                        eachCharTimer = 0.1f;                  // longer pause after a space
                    }
                    currTextIndexDisplayed += textLeft.Length; // Advance the index by amount of text copied over
                    String currPartOfFirstLine = firstLineTextToDisplay.Substring(0, currTextIndexDisplayed);
                    consoleText.mText = currPartOfFirstLine + mBlinkingChar + "\\n" + btmTextToDisplay;
                }
            }
        }
        else if (hasConsoleTextChanged == 0) // Screen is idling
        {
            // Checking if there are incoming messages waiting
            if (mMessageQueue.Count > 0)
            {
                if (mNextMessageTimer <= 0.0f) // First time triggering
                {
                    mNextMessageString       = mMessageQueue.Last.Value.Item1;
                    mNextMessageTimer        = mMessageQueue.Last.Value.Item2;
                    mPrevMessageHasColorTags = mMessageHasColorTags;
                    mMessageHasColorTags     = mMessageQueue.Last.Value.Item3;
                }

                mNextMessageTimer -= dt;
                if (mNextMessageTimer <= 0.0f) // Time to show next message
                {
                    AddMessage(mNextMessageString);
                    mMessageQueue.RemoveLast();
                }
            }
        }

        if (hasHeaderTextChanged == 2)
        {
            float timeForEachCharacter = 0.1f;
            mTimerForHeader -= dt;
            if (mTimerForHeader <= 0.0f)
            {
                mTimerForHeader = timeForEachCharacter;
                if (currHeaderIndexDisplayed >= mHeaderText.Length)
                {
                    hasHeaderTextChanged = 0;
                    mHeaderFont.mText    = mHeaderText;
                }
                else
                {
                    String textLeft = GrabOneCharFromString(mHeaderText, currHeaderIndexDisplayed);

                    currHeaderIndexDisplayed += textLeft.Length;
                    mHeaderFont.mText        += textLeft;
                }
            }
        }

        mBlinkingTimer -= dt;
        if (mBlinkingTimer <= 0.0f)
        {
            mBlinkingTimer         = 0.3f;
            mIsBlinkingCharVisible = !mIsBlinkingCharVisible;
            if (hasConsoleTextChanged == 0) // Nothing is typing out, then blink the char
            {
                UpdateAllTextImmediately();
            }
        }

#if ZERO
        if (hasNewTextToDisplay == 1) // Trigger 1 frame
        {
            consoleText.mText   = "";
            timer               = 0.0f;
            hasNewTextToDisplay = 2;

            mBlinkingLight.TriggerBlinkingLight(true); // start blinking
        }
        else if (hasNewTextToDisplay == 2)
        {
            float timeForEachCharacter = 0.1f;
            timer -= dt;
            if (timer <= 0.0f)
            {
                timer = timeForEachCharacter;

                consoleText.mText = firstLineTextToDisplay.Substring(0, consoleText.mText.Length + 1);
            }
        }
        else if (hasNewTextToDisplay == 3)
        {
            consoleText.mText = firstLineTextToDisplay;
        }

        if (hasNewTextToDisplay != 0 && consoleText.mText.Length == firstLineTextToDisplay.Length)
        {
            hasNewTextToDisplay = 0;                    // end of typing out

            mBlinkingLight.TriggerBlinkingLight(false); // stop blinking
        }
#endif
        UpdateEvent(dt);
    }
 void State_Panicking_Update()
 {
     gameObject.transform.Rotate(beginRot * MMath.GetRandomLimitedFloat(0.9f, 1.1f));
     sound.PlayIndependentEvent("C1_PAIN.vente", false, 2);
 }