public void OnUpdate()
    {
        const float maxParamValue = 65.0f;

        switch (mState)
        {
            case 0: break;
            case 1:
                {
                    mTimeElapsed += FrameController.DT();

                    float currParamValue = mTimeElapsed / mMaxTimeInMaze * maxParamValue;
                    if (currParamValue > maxParamValue) // Cap to 65 (max)
                    {
                        mState = 0;
                        currParamValue = maxParamValue;
                    }
                    mSound.SetUniqueEventParam(mMazeAmbientID, mMazeAmbientParam, currParamValue);

                    // Play once the creepy sound when around the middle of the time elapsed
                    if (!hasCreepSoundPlayed && mTimeElapsed >= mMaxTimeInMaze*0.4f)
                    {
                        hasCreepSoundPlayed = true;
                        mSound.PlayIndependentEvent("PERCUSSIVE_A.vente", false, 0);
                    }
                }
                break;
            case 2:
                {
                    mTimeElapsed += FrameController.DT();

                    float currParamValue = mTimeElapsed / mTimeToRelease * maxParamValue;
                    currParamValue = maxParamValue - currParamValue; // Count down from 65 to 0
                    if (currParamValue < 0.0f)
                    {
                        mState = 0;
                        currParamValue = 0.0f;
                        mSound.StopUniqueEvent(mMazeAmbientID, false);
                    }
                    else
                    {
                        mSound.SetUniqueEventParam(mMazeAmbientID, mMazeAmbientParam, currParamValue);
                    }
                }
                break;
        }
    }
 void State_Move_Exit()
 {
     mSound.StopUniqueEvent(footstepID, false); // do not release
 }
Esempio n. 3
0
 public void State_FlyTowardsWall_Exit()
 {
     sound.StopUniqueEvent(flyingSoundID, false);
 }