Example #1
0
        public MySound Load(string fileName, bool is3d)
        {
            var    position = new Vector3D(0f, 0f, 0f);
            var    source   = SoundEngine.GetSoundSource(fileName, true);
            ISound sound    = null;

            switch (is3d)
            {
            case true:
                sound = SoundEngine.Play3D(source, position.X, position.Y, position.Z, true, true, false);
                break;

            default:
                sound = SoundEngine.Play2D(source, true, true, false);
                break;
            }

            if (sound == null)
            {
                MessageBox.Show("Unsupported audio file format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            MySound mySound = new MySound(sound, source);

            allSounds.Add(mySound);
            return(mySound);
        }
Example #2
0
 public void Update(MySound mySound)
 {
     Position = mySound.Position;
     Loop     = mySound.Loop;
     Stopped  = mySound.Stopped;
     Volume   = mySound.Volume;
     if (Sound != null)
     {
         Sound.Volume = Volume;
     }
 }
Example #3
0
    public void Play(string name)
    {
        MySound sound = this.GetSound(name);

        if (sound.ambient)
        {
            this.PlayFadeInOut(sound.clip, ambientVolume);
        }
        else
        {
            sourceEffect.PlayOneShot(sound.clip, effectsVolume);
        }
    }
Example #4
0
    private IEnumerator EngineMonitor(PlayerControlInfo playerControlInfo)
    {
        while (true)
        {
            GameObject MySound;
            yield return(new WaitUntil(() => playerControlInfo.direction.magnitude > .2f));

            MySound = SoundManager.instance.StartLoop(EngineRun, p.ToString(), 0.3f * (myParts[p].val[(int)part.muffler] == 0 ? 2 : 1));
            MySound.GetComponent <AudioSource>().pitch = 1f + playerControlInfo.direction.magnitude;
            yield return(new WaitUntil(() => playerControlInfo.direction == Vector3.zero));

            SoundManager.instance.StopLoop(EngineRun, p.ToString());
        }
    }
Example #5
0
        public MySound Load(string fileName, bool is3d)
        {
            var position = new Vector3D(0f, 0f, 0f);
            var source = SoundEngine.GetSoundSource(fileName, true);
            ISound sound = null;

            switch (is3d)
            {
                case true:
                    sound = SoundEngine.Play3D(source, position.X, position.Y, position.Z, true, true, false);
                    break;
                default:
                    sound = SoundEngine.Play2D(source, true, true, false);
                    break;
            }

            if (sound == null)
            {
                MessageBox.Show("Unsupported audio file format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            MySound mySound = new MySound(sound, source);
            allSounds.Add(mySound);
            return mySound;
        }
Example #6
0
 public void RemoveSound(MySound mySound)
 {
     StopAllSounds();
     allSounds.RemoveAll(ms => ms.Equals(mySound));
 }
Example #7
0
 public void RemoveSound(MySound mySound)
 {
     StopAllSounds();
     allSounds.RemoveAll(ms => ms.Equals(mySound));
 }
Example #8
0
 public void PlaySound(MySound sound)
 {
     allSounds.FindLast(ms => ms.Id.Equals(sound.Id)).Play(SoundEngine);
 }
Example #9
0
    private static void PrepareUnitVoice(UnitParam unitParam)
    {
        // ISSUE: object of a compiler-generated type is created
        // ISSUE: variable of a compiler-generated type
        DownloadUtility.\u003CPrepareUnitVoice\u003Ec__AnonStorey1EF voiceCAnonStorey1Ef = new DownloadUtility.\u003CPrepareUnitVoice\u003Ec__AnonStorey1EF();
        // ISSUE: reference to a compiler-generated field
        voiceCAnonStorey1Ef.unitParam = unitParam;
        // ISSUE: reference to a compiler-generated field
        // ISSUE: reference to a compiler-generated field
        if (voiceCAnonStorey1Ef.unitParam == null || string.IsNullOrEmpty(voiceCAnonStorey1Ef.unitParam.voice))
        {
            return;
        }
        // ISSUE: reference to a compiler-generated field
        string[] strArray1 = MySound.VoiceCueSheetFileName(voiceCAnonStorey1Ef.unitParam.voice);
        if (strArray1 == null)
        {
            return;
        }
        for (int index = 0; index < strArray1.Length; ++index)
        {
            AssetManager.PrepareAssets("StreamingAssets/" + strArray1[index]);
        }
        string empty = string.Empty;

        // ISSUE: reference to a compiler-generated field
        if (voiceCAnonStorey1Ef.unitParam.skins != null)
        {
            List <ArtifactParam> artifacts = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.Artifacts;

            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            DownloadUtility.\u003CPrepareUnitVoice\u003Ec__AnonStorey1F0 voiceCAnonStorey1F0 = new DownloadUtility.\u003CPrepareUnitVoice\u003Ec__AnonStorey1F0();
            // ISSUE: reference to a compiler-generated field
            voiceCAnonStorey1F0.\u003C\u003Ef__ref\u0024495 = voiceCAnonStorey1Ef;
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            for (voiceCAnonStorey1F0.i = 0; voiceCAnonStorey1F0.i < voiceCAnonStorey1Ef.unitParam.skins.Length; ++voiceCAnonStorey1F0.i)
            {
                // ISSUE: reference to a compiler-generated method
                ArtifactParam artifact = artifacts.Find(new Predicate <ArtifactParam>(voiceCAnonStorey1F0.\u003C\u003Em__1B6));
                if (artifact != null && !string.IsNullOrEmpty(artifact.voice))
                {
                    // ISSUE: reference to a compiler-generated field
                    string charName = AssetPath.UnitVoiceFileName(voiceCAnonStorey1Ef.unitParam, artifact, string.Empty);
                    if (!string.IsNullOrEmpty(charName))
                    {
                        string[] strArray2 = MySound.VoiceCueSheetFileName(charName);
                        if (strArray2 != null)
                        {
                            for (int index = 0; index < strArray2.Length; ++index)
                            {
                                AssetManager.PrepareAssets("StreamingAssets/" + strArray2[index]);
                            }
                        }
                    }
                }
            }
        }
        // ISSUE: reference to a compiler-generated field
        if (voiceCAnonStorey1Ef.unitParam.job_voices == null)
        {
            return;
        }
        // ISSUE: reference to a compiler-generated field
        for (int index1 = 0; index1 < voiceCAnonStorey1Ef.unitParam.job_voices.Length; ++index1)
        {
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            string charName = AssetPath.UnitVoiceFileName(voiceCAnonStorey1Ef.unitParam, (ArtifactParam)null, (string)voiceCAnonStorey1Ef.unitParam.job_voices[index1]);
            if (!string.IsNullOrEmpty(charName))
            {
                string[] strArray2 = MySound.VoiceCueSheetFileName(charName);
                if (strArray2 != null)
                {
                    for (int index2 = 0; index2 < strArray2.Length; ++index2)
                    {
                        AssetManager.PrepareAssets("StreamingAssets/" + strArray2[index2]);
                    }
                }
            }
        }
    }
Example #10
0
 public bool IsPlaying(MySound sound)
 {
     return(!sound.Sound.Finished);
 }
Example #11
0
 public void StopSound(MySound sound)
 {
     sound.Sound.Stop();
 }
Example #12
0
    public void Play(string name)
    {
        MySound ms = Array.Find(sounds, MySound => MySound.name == name);

        ms.source.Play();
    }
 private void Init()
 {
     MySound.RestoreFromClearCache();
 }
Example #14
0
  public void CreateMySoundList () {

    AudioClip[] ac = Resources.LoadAll<AudioClip>( m_rSoundsPath ); 

    for (int s = 0; s < ac.Length; s++) {
      
      string name = ac[s].name.Split('_')[1];

      MySound ms = new MySound(ac[s], name);

      m_soundsList.Add(ms);
    }
  }
Example #15
0
 public void Update(MySound mySound)
 {
     allSounds.FindLast(ms => ms.Id.Equals(mySound.Id)).Update(mySound);
 }
Example #16
0
 public void Update(MySound mySound)
 {
     allSounds.FindLast(ms => ms.Id.Equals(mySound.Id)).Update(mySound);
 }
Example #17
0
 public void Update(MySound mySound)
 {
     Position = mySound.Position;
     Loop = mySound.Loop;
     Stopped = mySound.Stopped;
     Volume = mySound.Volume;
     if (Sound != null)
         Sound.Volume = Volume;
 }
Example #18
0
 public void StopSound(MySound sound)
 {
     sound.Sound.Stop();
 }
Example #19
0
 public bool IsPlaying(MySound sound)
 {
     return !sound.Sound.Finished;
 }
Example #20
0
 public void PlaySound(MySound sound)
 {
     allSounds.FindLast(ms => ms.Id.Equals(sound.Id)).Play(SoundEngine);
 }
Example #21
0
    // Update is called once per frame
    public void Play(string name)
    {
        MySound so = Array.Find(sounds, sound => sound.name == name);

        so.source.Play();
    }