예제 #1
0
        void IHandler <Start> .Handle(FrameArgs frame, Start e)
        {
            var musicChannel = new StreamingSoundChannel();
            var music        = new StreamingOpusFile("mario.opus");
            var co           = new CoroutineList <FrameArgs>();

            // make sure this all gets disposed/tracked
            this.AddMany(musicChannel, music, co);

            // start the music
            musicChannel.PlaySound(music);

            // loop will handle the sound effect
            co.Start(this.CoPlayRepeat());
        }
예제 #2
0
파일: Game.cs 프로젝트: Milstein/GameStack
        void IHandler <Start> .Handle(FrameArgs frame, Start e)
        {
            _cam   = new Camera2D(e.Size, 100f);
            _atlas = new Atlas("mario.atlas");
            _batch = new Batch();

            _sprites = new Sprite[] {
                _atlas["mushroom"],
                _atlas["fire-flower"],
                _atlas["star"],
                _atlas["red-shell"],
                _atlas["green-shell"],
                _atlas["goomba"]
            };
            _background       = _atlas["background"];
            _solidColor       = new SpriteMaterial(new SolidColorShader(), null);
            _solidColor.Color = new Vector4(0f, 0f, 0f, 0.65f);
            _boardBackground  = new Quad(_solidColor, Vector4.Zero, Vector4.One);

            for (var c = '0'; c <= '9'; c++)
            {
                _numbers.Add(c, _atlas[c.ToString()]);
            }

            _poof = new SpriteSequence(7, false, _atlas["smoke-1"], _atlas["smoke-2"], _atlas["smoke-3"], _atlas["smoke-4"]);
            this.Add(_poof);

            _sfx        = new SoundChannel();
            _sfx2       = new SoundChannel();
            _sndNoMatch = new SoundEffect("no-match.opus");
            _sndMatch   = new SoundEffect("match.opus");
            _sndLanding = new SoundEffect("landing.opus");
            _sndCoin    = new SoundEffect("coin.opus");
            _sndOneUp   = new SoundEffect("1-up.opus");

            _music         = new StreamingSoundChannel();
            _musicFile     = new StreamingOpusFile("mario.opus");
            _musicGameOver = new StreamingOpusFile("game-over.opus");
        }