Ejemplo n.º 1
0
        public static Sound Find(Sound.Name name)
        {
            instance.pNodeCompare.name = name;
            Sound image = (Sound)instance.baseFind(instance.pNodeCompare);

            return(image);
        }
        override public void Notify(float xCurs, float yCurs)
        {
            var inter = ColRect.Intersect(this.pFont.pFontSprite.pColRect, new ColRect(xCurs, yCurs, 1, 1));

            if (!this.pState && inter)
            {
                Sound.Name sound = Sound.Name.Uninitialized;
                switch (this.pRandom.Next(0, 3))
                {
                case (0):
                    sound = Sound.Name.Invader1;
                    break;

                case (1):
                    sound = Sound.Name.Invader2;
                    break;

                case (2):
                    sound = Sound.Name.Invader3;
                    break;

                case (3):
                    sound = Sound.Name.Invader4;
                    break;
                }
                SoundMan.PlaySound(sound);
                this.pFont.SetColor(1.0f, 1.0f, 1.0f);
                this.pState = true;
            }
            else if (!inter)
            {
                this.pState = false;
                this.pFont.SetColor(0.60f, 0.60f, 0.60f);
            }
        }
Ejemplo n.º 3
0
        override public void Execute(float deltaTime)
        {
            float value = pRandom.Next(10, 60);
            UFO   pUFO  = new UFO(GameObject.Name.UFO, GameSprite.Name.UFO, 100, 515);

            ColPair pColPair = ColPairMan.Add(ColPair.Name.UFO_WallLeft, pUFO, this.pWallLeft);

            pColPair.Attach(new UFOWallLeftObserver());

            pColPair = ColPairMan.Add(ColPair.Name.UFO_WallRight, pUFO, this.pWallRight);
            pColPair.Attach(new UFOWallRightObserver());

            MissileGroup pMissile = (MissileGroup)GameObjectMan.Find(GameObject.Name.MissileGroup);

            pColPair = ColPairMan.Add(ColPair.Name.UFOMissile, pUFO, pMissile);
            pColPair.Attach(new RemoveUFOObserver());

            pUFO.ActivateCollisionSprite(this.pSB_Boxes);
            pUFO.ActivateGameSprite(this.pSB_Aliens);
            GameObjectMan.Attach(pUFO);

            Sound.Name pSoundName = Sound.Name.Uninitialized;
            switch (pRandom.Next(0, 1))
            {
            case (0):
                pSoundName = Sound.Name.UFOLow;
                break;

            case (1):
                pSoundName = Sound.Name.UFOHigh;
                break;
            }
            SoundMan.PlaySound(pSoundName);
            TimerMan.Add(TimeEvent.Name.UFO, this, value);
        }
Ejemplo n.º 4
0
        public static void Play(Sound.Name nameToPlay)
        {
            SoundManager pMan = SoundManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            pMan.PrivPlaySound(nameToPlay);
        }
Ejemplo n.º 5
0
        public static void PlayMusic(Sound.Name name)
        {
            Debug.Assert(pMan != null);
            Sound snd = Find(name);

            Debug.Assert(snd != null);
            pMan.playing = pMan.sndEngine.Play2D(snd.GetSource(), false, false, false);
        }
Ejemplo n.º 6
0
        public static Sound Add(Sound.Name name, string path)
        {
            Debug.Assert(pMan != null);
            Sound pSound = (Sound)pMan.baseAdd();

            Debug.Assert(pSound != null);
            IrrKlang.ISoundSource soundSource = pMan.sndEngine.AddSoundSourceFromFile(path);
            pSound.Set(name, soundSource);
            return(pSound);
        }
Ejemplo n.º 7
0
        public static Sound Add(Sound.Name name, string filename)
        {
            SoundMan sMan  = SoundMan.privGetInstance();
            Sound    sound = (Sound)sMan.AddToFront();

            IrrKlang.ISoundSource source = sMan.engine.AddSoundSourceFromFile(filename);
            source.DefaultVolume = 0.1f;
            sound.Initialize(name, source);
            return(sound);
        }
        public static Sound Find(Sound.Name name)
        {
            SoundManager pMan = SoundManager.GetInstance();

            Debug.Assert(pMan != null);

            pMan.pNodeCompare.name = name;
            Sound pData = (Sound)pMan.BaseFind(pMan.pNodeCompare);

            return(pData);
        }
Ejemplo n.º 9
0
        public void Set(Sound.Name name, float volume)
        {
            String assetName = null;

            switch (name)
            {
            case Name.InvaderMarch1:
                assetName = Constants.soundInvaderMarch1;
                break;

            case Name.InvaderMarch2:
                assetName = Constants.soundInvaderMarch2;
                break;

            case Name.InvaderMarch3:
                assetName = Constants.soundInvaderMarch3;
                break;

            case Name.InvaderMarch4:
                assetName = Constants.soundInvaderMarch4;
                break;

            case Name.Invaderkilled:
                assetName = Constants.soundInvaderkilled;
                break;

            case Name.UFOHighPitch:
                assetName = Constants.soundUFOHighPitch;
                break;

            case Name.UFOLowPitch:
                assetName = Constants.soundUFOLowPitch;
                break;

            case Name.Shoot:
                assetName = Constants.soundShoot;
                break;

            case Name.Uninitialized:
                assetName = Constants.soundUninitialized;
                break;

            default:
                Debug.Assert(false, "Invalid texture name");
                break;
            }

            this.poSoundSource = SoundManager.GetEngine().AddSoundSourceFromFile(assetName);
            Debug.Assert(this.poSoundSource != null);

            this.poSoundSource.DefaultVolume = volume;

            this.name = name;
        }
Ejemplo n.º 10
0
        public void Attach(Sound.Name soundName)
        {
            // Create a new holder
            SoundNameHolder pSoundHolder = new SoundNameHolder(soundName);

            Debug.Assert(pSoundHolder != null);

            // Attach it to the TimedSoundEffect ( Push to front )
            SLink.AddToFront(ref this.poFirstSound, pSoundHolder);

            // Set the first one to this Sound
            this.pCurrentSound = pSoundHolder;
        }
Ejemplo n.º 11
0
        public static Sound Find(Sound.Name theName)
        {
            SoundManager pMan = SoundManager.privGetInstance();

            Debug.Assert(pMan != null);

            // set the static compare object for use
            pMan.poNodeCompare.SetName(theName);

            Sound pNode = (Sound)pMan.baseFind(pMan.poNodeCompare);

            return(pNode);
        }
Ejemplo n.º 12
0
        public static Sound Add(Sound.Name soundName, float volume = 1)
        {
            SoundManager pMan = SoundManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            Sound pNode = (Sound)pMan.BaseAdd();

            Debug.Assert(pNode != null);

            pNode.Set(soundName, volume);

            return(pNode);
        }
        public void Attach(Sound.Name soundName)
        {
            Sound pSound = SoundMan.Find(soundName);

            Debug.Assert(pSound != null);

            SoundHolder pSoundHolder = new SoundHolder(pSound);

            Debug.Assert(pSoundHolder != null);

            SLink.AddToFront(ref this.poFirstSound, pSoundHolder);

            this.pCurrSound = pSoundHolder;
        }
Ejemplo n.º 14
0
        public static IrrKlang.ISound PlaySound(Sound.Name name, bool loop = false)
        {
            Sound pSound = Find(name);

            Debug.Assert(pSound != null);

            SoundManager pMan = SoundManager.PrivGetInstance();

            Debug.Assert(pMan != null);
            Debug.Assert(pMan.poSndEngine != null);

            IrrKlang.ISound hardwareSound = pMan.poSndEngine.Play2D(pSound.GetSound(), loop, false, false);

            return(hardwareSound);
        }
Ejemplo n.º 15
0
        //----------------------------------------------------------------------------------
        // Methods
        //----------------------------------------------------------------------------------

        public void Attach(Sound.Name soundName)
        {
            // Perhaps make a sound Manager??
            Sound pSound = SoundManager.Find(soundName);

            Debug.Assert(pSound != null);

            SoundHolder pSoundHold = new SoundHolder(pSound);

            Debug.Assert(pSoundHold != null);

            DLink.AddToEnd(ref this.poFirstSound, pSoundHold);

            this.pCurrentSound = pSoundHold;
        }
        public static Sound Add(Sound.Name name, string pSoundName)
        {
            SoundManager pMan = SoundManager.GetInstance();

            Debug.Assert(pMan != null);

            Sound pNode = (Sound)pMan.BaseAdd();

            Debug.Assert(pNode != null);

            // Initialize the data
            Debug.Assert(pSoundName != null);
            pNode.Set(name, pSoundName, ref pSoundEngine);

            return(pNode);
        }
Ejemplo n.º 17
0
        public static Sound Find(Sound.Name name)
        {
            DLink ptr = pMan.poActive;

            while (ptr != null)
            {
                if (((Sound)ptr).GetName() == name)
                {
                    return((Sound)ptr);
                }

                ptr = ptr.pNext;
            }

            return(null);
        }
Ejemplo n.º 18
0
        public static void PlaySound(Sound.Name name, float volume = 1.0f)
        {
            Debug.Assert(name != Sound.Name.Uninitialized);
            SoundMan sMan  = SoundMan.privGetInstance();
            Sound    pHead = (Sound)sMan.pActive;

            while (pHead != null)
            {
                if (pHead.name == name)
                {
                    IrrKlang.ISound sound = sMan.engine.Play2D(pHead.source, false, false, false);
                }

                pHead = (Sound)pHead.pNext;
            }
        }
Ejemplo n.º 19
0
        public static Sound Add(Sound.Name soundName, string fileName, float repeatTimeInterval = 1.0f)
        {
            SoundManager pImgManager = SoundManager.privGetInstance();

            Debug.Assert(pImgManager != null);

            // grab an blank imgage node
            Sound pNode = (Sound)pImgManager.baseAdd();

            Debug.Assert(pNode != null);


            //configure the image node
            pNode.Set(soundName, fileName, repeatTimeInterval);

            return(pNode);
        }
Ejemplo n.º 20
0
        private void PrivPlaySound(Sound.Name nameToPlay)
        {
            switch (nameToPlay)
            {
            case Sound.Name.AlienMove1:
                this.poSoundEngine.Play2D(this.poAlienMove1, false, false, false);
                break;

            case Sound.Name.AlienMove2:
                this.poSoundEngine.Play2D(this.poAlienMove2, false, false, false);
                break;

            case Sound.Name.AlienMove3:
                this.poSoundEngine.Play2D(this.poAlienMove3, false, false, false);
                break;

            case Sound.Name.AlienMove4:
                this.poSoundEngine.Play2D(this.poAlienMove4, false, false, false);
                break;

            case Sound.Name.PlayerShoot:
                this.poSoundEngine.Play2D(this.poPlayerShoot, false, false, false);
                break;

            case Sound.Name.PlayerExplode:
                this.poSoundEngine.Play2D(this.poPlayerExplode, false, false, false);
                break;

            case Sound.Name.AlienExplode:
                this.poSoundEngine.Play2D(this.poAlienExplode, false, false, false);
                break;

            case Sound.Name.UFO_High:
                this.poSoundEngine.Play2D(this.poUFO_High, false, false, false);
                break;

            case Sound.Name.UFO_Low:
                this.poSoundEngine.Play2D(this.poUFO_Low, false, false, false);
                break;

            default:
                Debug.Assert(false);
                break;
            }
        }
Ejemplo n.º 21
0
 public override void Wash()
 {
     this.poSoundSource = null;
     this.name          = Name.Uninitialized;
     this.volume        = 1;
 }
Ejemplo n.º 22
0
 public Sound() : base()
 {
     this.name    = Sound.Name.Uninitialized;
     this.source  = null;
     this.pRepeat = 0.0f;
 }
Ejemplo n.º 23
0
 public void Set(Sound.Name soundName, string fileName, float repeatTimeInterval)
 {
     this.name    = soundName;
     this.source  = engine.AddSoundSourceFromFile(fileName);
     this.pRepeat = repeatTimeInterval;
 }
Ejemplo n.º 24
0
 public void SetName(Sound.Name soundName)
 {
     this.name = soundName;
 }
Ejemplo n.º 25
0
 public void Wash()
 {
     this.name    = Sound.Name.Uninitialized;
     this.source  = null;
     this.pRepeat = 0.0f;
 }
Ejemplo n.º 26
0
 public Sound()
 {
     this.name          = Name.Uninitialized;
     this.poSoundSource = null;
     this.volume        = 1;
 }
Ejemplo n.º 27
0
 public Sound(Sound.Name name, float volume)
 {
     Set(name, volume);
 }
Ejemplo n.º 28
0
 public void Set(Sound.Name name, IrrKlang.ISoundSource snd)
 {
     this.name = name;
     this.src  = snd;
 }
Ejemplo n.º 29
0
 public void SetName(Sound.Name newName)
 {
     this.name = newName;
 }
Ejemplo n.º 30
0
 public SoundNameHolder(Sound.Name soundName)
     : base()
 {
     this.soundName = soundName;
 }