void Start()
 {
     rec       = GetComponent <ResonanceAudioSource>();
     animator  = GetComponent <Animator>();
     audioData = GetComponent <AudioSource>();
     turn      = new Vector3(0, -25, 0);
     turn2     = new Vector3(0, 25, 0);
 }
Beispiel #2
0
 void OnEnable()
 {
     bypassRoomEffects            = serializedObject.FindProperty("bypassRoomEffects");
     directivityAlpha             = serializedObject.FindProperty("directivityAlpha");
     directivitySharpness         = serializedObject.FindProperty("directivitySharpness");
     listenerDirectivityAlpha     = serializedObject.FindProperty("listenerDirectivityAlpha");
     listenerDirectivitySharpness = serializedObject.FindProperty("listenerDirectivitySharpness");
     directivityTexture           = Texture2D.blackTexture;
     gainDb           = serializedObject.FindProperty("gainDb");
     occlusionEnabled = serializedObject.FindProperty("occlusionEnabled");
     quality          = serializedObject.FindProperty("quality");
     source           = (ResonanceAudioSource)target;
 }
    void Awake()
    {
        // get public componenets from AngleSource.cs
        angleSource = GetComponent <AngleSource>();

        // get public components from ResonanceAudioSource.cs
        resonanceSource = GetComponent <ResonanceAudioSource>();

        // fetch game objects
        Source1 = GameObject.Find("Source1");
        Source2 = GameObject.Find("Source2");
        Source3 = GameObject.Find("Source3");
        Source4 = GameObject.Find("Source4");
        Source5 = GameObject.Find("Source5");
        Source6 = GameObject.Find("Source6");
        Source7 = GameObject.Find("Source7");
    }
    void GatherComponents()
    {
        if (!audio)
        {
            audio = GetComponent <AudioSource>();
        }
        if (!audio)
        {
            Debug.Log("Audiosource missing on: " + gameObject.name);
        }

        if (!resAudio)
        {
            resAudio = GetComponent <ResonanceAudioSource>();
        }
        if (!resAudio)
        {
            Debug.Log("Audiosource missing on: " + gameObject.name);
        }
    }
        // -----------------------------------

        void Awake()
        {
            _audioSrc        = GetComponent <AudioSource>();
            soundIcons       = GetComponentInChildren <SoundIcons>();
            followCameraYPos = GetComponent <FollowMainCameraYPosition>();

            resonance = GetComponent <ResonanceAudioSource>();

            filterLowPass    = GetComponent <AudioLowPassFilter>();
            filterHighPass   = GetComponent <AudioHighPassFilter>();
            filterDistortion = GetComponent <AudioDistortionFilter>();
            filterEcho       = GetComponent <AudioEchoFilter>();
            filterPhaser     = GetComponent <AudioPhaser>();

            filterLowPass.enabled    = false;
            filterHighPass.enabled   = false;
            filterDistortion.enabled = false;
            filterEcho.enabled       = false;
            filterPhaser.setEnabled(false);

            followCameraYPos.enabled      = false;
            markerTrigger.triggerDelegate = this;
        }
    private void PlaySound()
    {
        Dictionary <GameObject, bool> tempChangedSoundBoxDic = new Dictionary <GameObject, bool>();

        foreach (KeyValuePair <GameObject, bool> keyValuePair in mExistSoundBoxDic)
        {
            if (!keyValuePair.Value)
            {
                GameObject           soundBoxGO           = keyValuePair.Key;
                ResonanceAudioSource resonanceAudioSource = soundBoxGO.GetComponent <ResonanceAudioSource>();
                if (resonanceAudioSource.audioSource.isPlaying)
                {
                    tempChangedSoundBoxDic.Add(soundBoxGO, true);
                }
                else
                {
                    resonanceAudioSource.audioSource.clip.LoadAudioData();
                    resonanceAudioSource.audioSource.Play();

                    AudioSource audioSource = soundBoxGO.GetComponent <AudioSource>();
                    audioSource.spatialize            = true;
                    audioSource.spatializePostEffects = true;

                    mLogger.CategoryLog(LogCategoryMethodTrace, "playing: " + resonanceAudioSource.audioSource.isPlaying);
                    tempChangedSoundBoxDic.Add(soundBoxGO, resonanceAudioSource.audioSource.isPlaying);
                }
            }
        }

        foreach (KeyValuePair <GameObject, bool> keyValuePair in tempChangedSoundBoxDic)
        {
            if (keyValuePair.Value)
            {
                mExistSoundBoxDic[keyValuePair.Key] = true;
            }
        }
    }
Beispiel #7
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
#if UNITY_ANDROID
        string[] dataPath = (Application.persistentDataPath.Replace("Android", "")).Split(new string[] { "//" }, System.StringSplitOptions.None); //"/storage/sdcard0/Music"
        Debug.Log(dataPath + "persistant data path : " + dataPath[0]);
        myPath = dataPath[0];                                                                                                                     //  storage/emulated/0
        Debug.Log("Source Root Path: " + dataPath[0]);
#elif UNITY_STANDALONE
        myPath = "D:/PersonalProjects/AudioTest/Assets/Music";  //C:/Users/HUNNY/Music/ogg
        Debug.Log("in awake");
#elif Unity_Editor
        myPath = "Builds/Music";
#endif
        resonanceAudio = surroundSoundAC.gameObject.GetComponent <ResonanceAudioSource>();
        SetUpAudioPlayeForNomal();
    }
 void Awake()
 {
     audioSource = GetComponent <ResonanceAudioSource>();
 }