Exemplo n.º 1
0
        private bool HearMusic(List <Filter> filters)
        {
            bool musicHeard = false;
            bool invert     = false;

            foreach (Filter f in filters)
            {
                /// This inversion is ugly, but we don't have a sensorTarget to add to the
                /// list, so a Count==Zero filter would always come up true. An alternative
                /// might be to pretend the GameActor is making the music, so there always
                /// would be a direct object. Going to go with that, leaving this code
                /// here in case something goes wrong, will try to delete after checkin.
                //CountFilter countFilter = f as CountFilter;
                //if (countFilter != null)
                //{
                //    if ((countFilter.count1 == 0) && (countFilter.operand1 == Operand.Equal))
                //    {
                //        invert = true;
                //    }
                //}
                SoundFilter soundFilter = f as SoundFilter;
                if (soundFilter != null)
                {
                    if (BokuGame.Audio.IsPlaying(null, soundFilter.sound))
                    {
                        musicHeard = true;
                    }
                }
            }
            if (invert)
            {
                musicHeard = !musicHeard;
            }
            return(musicHeard);
        }
Exemplo n.º 2
0
        public override ProgrammingElement Clone()
        {
            SoundFilter clone = new SoundFilter();

            CopyTo(clone);
            return(clone);
        }
Exemplo n.º 3
0
        private bool ListeningForMusic(List <Filter> filters)
        {
            bool listenForMusic = false;

            foreach (Filter f in filters)
            {
                ClassificationFilter classFilter = f as ClassificationFilter;
                if (classFilter != null)
                {
                    /// Don't mess around, a class filter disqualifies the whole process.
                    return(false);
                }
                SoundFilter soundFilter = f as SoundFilter;
                if (soundFilter != null)
                {
                    if (!BokuGame.Audio.IsSpatial(soundFilter.sound))
                    {
                        listenForMusic = true;
                    }
                }
            }
            return(listenForMusic);
        }
Exemplo n.º 4
0
 protected void CopyTo(SoundFilter clone)
 {
     base.CopyTo(clone);
     clone.sound         = this.sound;
     clone.previewLength = this.previewLength;
 }