Ejemplo n.º 1
0
    // Update is called once per frame
    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "Player")
        {
            m_audioLib.SetFloatParameter(Hv_RandomWalk_AudioLib.Parameter.Unity_state, 0);
            m_audioLib.SetFloatParameter(Hv_RandomWalk_AudioLib.Parameter.Unity_state, m_nextState);

            GetComponent <AudioSource>().PlayOneShot(Sound, 2.7F);
        }
    }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        bool isEnabled = _dsp.IsInstantiated();

        if (!isEnabled)
        {
            EditorGUILayout.LabelField("Press Play!", EditorStyles.centeredGreyMiniLabel);
        }
        GUILayout.EndVertical();

        // parameters
        GUI.enabled = true;
        GUILayout.BeginVertical();
        EditorGUILayout.Space();
        EditorGUI.indentLevel++;

        // a
        GUILayout.BeginHorizontal();
        float a    = _dsp.GetFloatParameter(Hv_RandomWalk_AudioLib.Parameter.A);
        float newA = EditorGUILayout.Slider("a", a, 0.0f, 100.0f);

        if (a != newA)
        {
            _dsp.SetFloatParameter(Hv_RandomWalk_AudioLib.Parameter.A, newA);
        }
        GUILayout.EndHorizontal();

        // tempo
        GUILayout.BeginHorizontal();
        float tempo    = _dsp.GetFloatParameter(Hv_RandomWalk_AudioLib.Parameter.Tempo);
        float newTempo = EditorGUILayout.Slider("tempo", tempo, 100.0f, 10000.0f);

        if (tempo != newTempo)
        {
            _dsp.SetFloatParameter(Hv_RandomWalk_AudioLib.Parameter.Tempo, newTempo);
        }
        GUILayout.EndHorizontal();

        // unity_state
        GUILayout.BeginHorizontal();
        float unity_state    = _dsp.GetFloatParameter(Hv_RandomWalk_AudioLib.Parameter.Unity_state);
        float newUnity_state = EditorGUILayout.Slider("unity_state", unity_state, 0.0f, 4.0f);

        if (unity_state != newUnity_state)
        {
            _dsp.SetFloatParameter(Hv_RandomWalk_AudioLib.Parameter.Unity_state, newUnity_state);
        }
        GUILayout.EndHorizontal();
        EditorGUI.indentLevel--;
    }