コード例 #1
0
    void DrawCustomInspector()
    {
        source = target as SoundSourcePlayer;

        SoundInspectorView.Instance.SetContent(source.source, SoundInspectorView.ContentType.soundSource);
        SoundInspectorView.Instance.soundSourceInspectorLayout.drawSoundSource(false, false);
        SoundInspectorView.Instance.soundSourceInspectorLayout.drawSettingsSource(false, false);
        SoundInspectorView.Instance.soundSourceInspectorLayout.drawSoundSource3d(false, false);
        SoundInspectorView.Instance.soundSourceInspectorLayout.drawTransitionOptions(false, false);
    }
コード例 #2
0
 public void playSoundAtBeat(SoundSourcePlayer source)
 {
     //play the specified sound at the specified beat
     delayedSounds.Add(new DelayedSound(source));
 }
コード例 #3
0
    void setTrigger(SoundSource ss, SoundSourcePlayer player)
    {
        switch (ss.triggerType){
            case(SoundSource.TriggerType.Static):{
                PlayTrigger.Play(_audioManager.mainMixer, ss);
                break;
            }

            case(SoundSource.TriggerType.Dynamic):{
                if (ss.playOnEnter){
                    // attatch play on enter script
                    gameObject.AddComponent<PlayOnEnter>().triggeredPlayers.Add(player);
                }

                if (ss.playOnExit){
                    gameObject.AddComponent<PlayOnExit>().triggeredPlayers.Add(player);
                    // attatch play on exit script
                }

                if (ss.playOnDestroy){
                    gameObject.AddComponent<PlayOnDestroy>().triggeredPlayers.Add(player);

                    // attatch play on destroy script
                }
                break;
            }
        }
    }
コード例 #4
0
        public SoundSourcePlayer soundSourcePlayer; //set up an audio source

        #endregion Fields

        #region Constructors

        public DelayedSound(SoundSourcePlayer source)
        {
            //set up new sound and beat
            soundSourcePlayer = source;
            bpm = soundSourcePlayer.source.bpm;
            beatCount = soundSourcePlayer.source.timeSignature;
            nextEventTime = latestSecond + ((60.0f / bpm) * beatCount);
            Debug.Log("Created at " + AudioSettings.dspTime + " and playing at " + nextEventTime);
        }