{                                                                                                             // used in conjunction with SoundStruct.cs
    public static SoundStruct AddSound(string file_location, Transform transformation, Rigidbody2D rigidbody) // This function is used in other scripts to play the sound diagetically
    {
        SoundStruct sound = CreateSound(file_location);                                                       // calls the below function

        FMODUnity.RuntimeManager.AttachInstanceToGameObject(sound.instance, transformation, rigidbody);       //attaches the sound to a gameobject
        return(sound);                                                                                        //outputs the sound
    }
Пример #2
0
 public void AddSound(string assetName, string assetPath)
 {
     SoundStruct sound = new SoundStruct();
     sound.name = assetName;
     sound.soundEffect = game.Content.Load<SoundEffect>(assetPath);
     sound.soundEffectInstance = sound.soundEffect.CreateInstance();
     Sounds.Add(assetName, sound);
 }
Пример #3
0
    private static SoundStruct CreateSound(string file_location)                                     // creates a sound from FMOD Event and then plays it
                                                                                                     // addendum: this also works with snapshots, which wasn't intentional, but it works!
    {
        FMOD.Studio.EventInstance instance = FMODUnity.RuntimeManager.CreateInstance(file_location); //"file_location" is the event path in FMOD, this is used to reference the path
        SoundStruct sound = new SoundStruct(instance, file_location);                                //the referenced path is then generated in this class

        instance.start();                                                                            // plays the sound whenever it is called
        return(sound);                                                                               //outputs the sound
    }
Пример #4
0
    private void LoadSound(ref SoundStruct[] _soundArray, int _count, string _path)
    {
        int soundCount = _count;

        _soundArray = new SoundStruct[soundCount];

        Object[] soundList = Resources.LoadAll(_path);

        if (soundList.Length <= 0)
        {
            return;
        }

        for (int i = 0; i < soundCount; i++)
        {
            // 앞에 3글자는 인덱스로 씀
            string indexStr = soundList[i].name.Substring(0, 3);
            int    index    = Utils.IntConvert(indexStr);
            _soundArray[index] = new SoundStruct(soundList[i] as AudioClip, 1f);
        }
    }
    public static SoundStruct AddSound2D(string file_location) // This function is used in other scripts to play the sound nondiagetically
    {
        SoundStruct sound = CreateSound(file_location);        // calls the below function

        return(sound);                                         //outputs the sound
    }
Пример #6
0
 private void Start()
 {
     vehicle_transform = this.GetComponent <Transform>();
     parameter_test    = SoundFactory.AddSound("event:/enginetest", null, null);
     parameter_value   = 0f;
 }