getParameterValue() public method

public getParameterValue ( string name, float &value ) : RESULT
name string
value float
return RESULT
Beispiel #1
0
    public void SetInnerBGM()
    {
        // wtf????
        float value      = 0;
        float finalValue = 0;

        bgmInstance.getParameterValue(LEVEL_OUTER_BGM_PARAS, out value, out finalValue);

        Services.taskManager
        .Do(new FmodInstanceTask(bgmInstance, LEVEL_OUTER_BGM_PARAS, value, 0, 1));
    }
Beispiel #2
0
    IEnumerator FadeParameter(string parameterName, float parameterTargetValue, float fadeMultiplier, bool fadeIn)     //coroutine (can think of it as a function that exists outside of this code)
    // Code not used. This coroutine was used to fade the game parameter but that functionality was later moved to Fmod for simplicity.
    // parameterName (the name of the parameter we're adjusting, parameterTargetValue (the value we're trying to reach), fadeMultiplier (the number added to increment finalValue to reach parameterTargetValue),
    // bool fadeIn (on true, fades parameter in, on false fades out)
    {
        float currentParamValue;                                                               //value of the current parameter
        float finalValue;                                                                      //final value of the parameter

        EventInstance.getParameterValue(parameterName, out currentParamValue, out finalValue); //checks the current  value of the parameter
        if (fadeIn == true)                                                                    //checks if we're fading in
        {
            while (finalValue < parameterTargetValue)                                          //while finalValue is less than the value we're trying to reach, unity will keep executing the code below this
            {
                finalValue = finalValue + fadeMultiplier;                                      //increments finalValue with the fadeMultiplier
                EventInstance.setParameterValue(parameterName, finalValue);                    //adjust the parameter value to new finalValue
                yield return(new WaitForSeconds(.1f));                                         //wait for 0.1 seconds before looping again
            }
        }
        else// if fadeIn is false
        {
            while (finalValue > parameterTargetValue)//checks if the finalValue is larger than the parameterTargetValue
            {
                finalValue = finalValue - fadeMultiplier;                   //this adjusts the finalValue by subtracting the fadeMultiplier from it
                EventInstance.setParameterValue(parameterName, finalValue); //adjusts the new finalValue
                yield return(new WaitForSeconds(.1f));                      //wait for 0.1 seconds before looping again
            }
        }

        yield return(null);
    }
Beispiel #3
0
    private void FixedUpdate()
    {
        excitationTimer      += Time.deltaTime;
        ambianceCommentTimer += Time.deltaTime;

        if (excitationTimer > intervalBeforeExcitationDecrease && crowdExcitationRatio >= 0.05f)
        {
            Debug.Log("Le public s'emmerde !");
            crowdExcitationRatio -= 0.05f;
            excitationTimer       = 0.0f;
        }

        float parameterValue = 0f;

        crowd.getParameterValue("CrowdExcitation", out parameterValue, out parameterValue);
        //Debug.Log(parameterValue);
        if (parameterValue != crowdExcitationRatio)
        {
            Debug.Log("changing crowd excitation to " + crowdExcitationRatio);
            crowd.setParameterValue("CrowdExcitation", crowdExcitationRatio);
        }

        if (ambianceCommentTimer > intervalBeforeAmbianceComment && crowdExcitationRatio >= 0.5f && Random.Range(0, 100) < 50)
        {
            Debug.Log("L'ambiance !");
            ambianceReactionSpeechEvent.start();
            //ambianceReactionSpeechEvent.release();
            ambianceCommentTimer = 0f;
        }
        //seconds++;
        if (start)
        {
            timer += Time.deltaTime;
            if (!end)
            {
                seconds = (int)timer % 60;
                minuts  = (int)System.Math.Ceiling(timer / 60 - 1);
            }
            if (minuts == 5)
            {
                end = true;
            }

            timeText.text = "Time : " + minuts.ToString("00") + " : " + seconds.ToString("00");
        }

        if (doubleDribbling())
        {
            p1 = getPlayerDribbling(player);
            p2 = getPlayerDribbling(player1);
            conflictDribble = Random.Range(0f, 1f);
            if (conflictDribble < 0.5f)
            {
                //Debug.Log("le 1 " + p1);
                AI_Player a = p1.GetComponent("AI_Player") as AI_Player;
                if (a != null)
                {
                    a.transform.position = new Vector3(a.transform.position.x - 3, a.transform.position.y, a.transform.position.z - 3);
                    a.stateMachine.ChangeState(FirstState.Instance);
                }
            }
            else
            {
                //Debug.Log("le 2 " + p2);
                AI_Player a = p2.GetComponent("AI_Player") as AI_Player;
                if (a != null)
                {
                    a.transform.position = new Vector3(a.transform.position.x + 3, a.transform.position.y, a.transform.position.z + 3);
                    a.stateMachine.ChangeState(FirstState.Instance);
                }
            }
        }

        if (end)
        {
            if (GameConstants.RedScore > GameConstants.BlueScore)
            {
                endCText.text = "Victoire des rouges !";
            }
            else if (GameConstants.RedScore < GameConstants.BlueScore)
            {
                endCText.text = "Victoire des bleues !";
            }
            else
            {
                endCText.text = "Match nul";
            }

            crowd.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
            ball.GetComponent <Rigidbody>().velocity *= 0;
            ball.transform.position = new Vector3(0f, 1.5f, 144f);
            endC.gameObject.SetActive(true);
            menu_btn.SetActive(true);
            foreach (GameObject p in player)
            {
                AI_Player a = p.GetComponent("AI_Player") as AI_Player;
                if (a != null)
                {
                    a.finish = true;
                    a.stateMachine.ChangeState(BeginState.Instance);
                }
            }

            foreach (GameObject p in player1)
            {
                AI_Player a = p.GetComponent("AI_Player") as AI_Player;
                if (a != null)
                {
                    a.finish = true;
                    a.stateMachine.ChangeState(BeginState.Instance);
                }
            }
        }
    }