Beispiel #1
0
        private void Start()
        {
            mediator = GetComponent <PlayerMediator>();

            specialPoint
            .Subscribe(x => mediator.OnSpecialChanged(x / maxSpecialPoint))
            .AddTo(this);

            // ポイントが最大になったらバフ
            specialPoint
            .Where(x => x >= maxSpecialPoint && !isBuffing)
            .Subscribe(_ => {
                isBuffing = true;
                mediator.StartBuff();
                CutInAsync().Forget();
            })
            .AddTo(this);

            // ポイントが0になったらバフ解除
            specialPoint
            .Where(x => x <= 0 && isBuffing)
            .Subscribe(_ => {
                isBuffing = false;
                mediator.StopBuff();
                bgmPlayer.Play(soundDatabase.MainBgm);
            })
            .AddTo(this);
        }
Beispiel #2
0
        private void ScaleSplat(float dT)
        {
            if (speed < 9.0f)
            {
                speed += 0.5f;
            }
            if (splatScale.X > 1.0f)
            {
                splatScale.X -= speed * dT;
            }
            if (splatScale.Y > 1.0f)
            {
                splatScale.Y -= speed * dT;
            }

            if (splatScale.X <= 1.8f && !playing)
            {
                SoundPlayer.Play();
                playing = true;
            }
            if (SoundPlayer.Status != BgmStatus.Playing && playing)
            {
                SoundPlayer.Stop();
                SoundPlayer.Dispose();
                SoundPlayer = metalSound.CreatePlayer();
            }



            splat.Scale = splatScale;
        }
Beispiel #3
0
 public static void PlayGameover()
 {
     bgmPlayer.Dispose();
     bgmPlayer = gameover.CreatePlayer();
     bgmPlayer.Loop = true;
     bgmPlayer.Play();
 }
        public EndGameScene()
        {
            scene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            scene.Camera.SetViewFromViewport();

            textureInfo       = new TextureInfo("/Application/Assets/endBackground.png");
            background        = new SpriteUV(textureInfo);
            background.Quad.S = textureInfo.TextureSizef;
            scene.AddChild(background);
            timer = 0.0f;

            scoreTxt          = new Label();
            scoreTxt.Text     = "Score: " + ScoreManager.Instance.getScore();
            scoreTxt.Scale    = new Vector2(5.0f, 5.0f);
            scoreTxt.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width / 2 - 150, Director.Instance.GL.Context.GetViewport().Height *0.1f);
            scoreTxt.Color    = new Vector4(0.0f, 1.0f, 0.0f, 1.0f);

            Bgm hahaSound = new Bgm("/Application/Audio/Haha.mp3");

            hahaSoundPlayer = hahaSound.CreatePlayer();
            //Fix when it plays
            hahaSoundPlayer.Play();



            scene.AddChild(scoreTxt);

            ScoreManager.Instance.reset();
        }
 /// <summary>
 /// 建立音乐播放器
 /// </summary>
 public void CreatMusicPlayer(Bgm music)
 {
     MusicPlayer        = music.CreatePlayer();
     MusicPlayer.Volume = 0;
     MusicPlayer.Loop   = musicLoop;
     MusicPlayer.Play();
 }
 static void HandlePlay_btnButtonAction(object sender, TouchEventArgs e)
 {
     // Check that the BgmPlayer is not already playing. If it is and we re-call Play(), it will crash the app.
     if (player.Status != BgmStatus.Playing)
     {
         player.Play();
     }
 }
Beispiel #7
0
 public void BgmChange(object sender, RoutedEventArgs args)
 {
     string[] bgmFiles = Directory.GetFiles("bgm", "*.mp3");
     if (bgmFiles.Length > 0)
     {
         BgmPlayer.Source = new Uri(bgmFiles[(++bgmIndex) % bgmFiles.Length], UriKind.RelativeOrAbsolute);
         BgmPlayer.Play();
     }
 }
Beispiel #8
0
        /// BGMの再生
        public void PlayBgm(BgmId id, bool loop)
        {
            StopBgm();

            bgmPlayer      = bgmList[(int)id].CreatePlayer();
            bgmPlayer.Loop = loop;
            bgmPlayer.Play();
            bgmPlayer.Volume = 0.1f;
        }
Beispiel #9
0
        private void BgmInitialize(object sender, EventArgs e)
        {
            bgmIndex  = 0;
            isBgmMute = false;

            string[] bgmFiles = Directory.GetFiles("bgm", "*.mp3");
            if (bgmFiles.Length > 0)
            {
                BgmPlayer.Source = new Uri(bgmFiles[bgmIndex], UriKind.RelativeOrAbsolute);
                BgmPlayer.Play();
            }
        }
Beispiel #10
0
        public static bool Update()
        {
            uint enableColor  = 0xffffffff;
            uint disableColor = 0xff7f7f7f;

            playButton.ButtonColor   = disableColor;
            stopButton.ButtonColor   = disableColor;
            pauseButton.ButtonColor  = disableColor;
            resumeButton.ButtonColor = disableColor;

            if (bgmPlayer.Status == BgmStatus.Stopped)
            {
                playButton.ButtonColor = enableColor;
            }
            else if (bgmPlayer.Status == BgmStatus.Playing)
            {
                stopButton.ButtonColor  = enableColor;
                pauseButton.ButtonColor = enableColor;
            }
            else if (bgmPlayer.Status == BgmStatus.Paused)
            {
                stopButton.ButtonColor   = enableColor;
                resumeButton.ButtonColor = enableColor;
            }

            List <TouchData> touchDataList = Touch.GetData(0);

            if (playButton.ButtonColor == enableColor &&
                playButton.TouchDown(touchDataList))
            {
                bgmPlayer.Play();
            }
            if (stopButton.ButtonColor == enableColor &&
                stopButton.TouchDown(touchDataList))
            {
                bgmPlayer.Stop();
            }
            if (pauseButton.ButtonColor == enableColor &&
                pauseButton.TouchDown(touchDataList))
            {
                bgmPlayer.Pause();
            }
            if (resumeButton.ButtonColor == enableColor &&
                resumeButton.TouchDown(touchDataList))
            {
                bgmPlayer.Resume();
            }

            volumeSlider.Update(touchDataList);
            bgmPlayer.Volume = volumeSlider.Rate;

            return(true);
        }
Beispiel #11
0
        public AudioManager()
        {
            System.Diagnostics.Debug.WriteLine("Audio manager constructor");
            _titleSong = new Bgm("/Application/audio/titlesong.mp3");
            _mainSong = new Bgm("/Application/audio/wikistep.mp3");

            if(_songPlayer != null) {
                _songPlayer.Dispose();
            }
            _songPlayer = _titleSong.CreatePlayer();
            _songPlayer.Loop = true;
            _songPlayer.Play ();
        }
Beispiel #12
0
        public override void OnEnter()
        {
            BaseScene.SetUpScene(this, "assets/backdrop/dungeon-colour.png", ref sprite,
                                 550f, new Vector2(0, 0), new Vector2i(1, 1));

            music = new Bgm("assets/Music/creepyloop.mp3");

            player = music.CreatePlayer();

            player.Play();

            base.OnEnter();
        }
Beispiel #13
0
 internal void Play()
 {
     if (_currentSong != this) //If needed switch up the current song
     {
         if (_bgmPlayer != null)
         {
             _bgmPlayer.Stop();
             _bgmPlayer.Dispose();
         }
         _bgmPlayer   = _bgm.CreatePlayer();
         _currentSong = this;
     }
     _bgmPlayer.Play();
 }
Beispiel #14
0
        public override void OnEnter()
        {
            BaseScene.SetUpScene(this, "assets/backdrop/good town.png", ref sprite,
                                 550f, new Vector2(0, 0), new Vector2i(1, 1));
            music = new Bgm("assets/Music/sappypianointerlude.mp3");

            player = music.CreatePlayer();

            player.Play();



            base.OnEnter();
        }
Beispiel #15
0
        //Background Music
        private static void MusicPlay(string music)
        {
            try
            {
                bgmp.Dispose();
            }
            catch {}

            Bgm bgm = new Bgm(music);

            bgmp      = bgm.CreatePlayer();
            bgmp.Loop = true;
            bgmp.Play();
        }
Beispiel #16
0
        public override void OnEnter()
        {
            BaseScene.SetUpScene(this, "assets/backdrop/fortress-01.png", ref sprite,
                                 550f, new Vector2(0, 0), new Vector2i(1, 1));

            music = new Bgm("assets/Music/dirgeloop.mp3");

            player = music.CreatePlayer();

            player.Play();



            base.OnEnter();
        }
Beispiel #17
0
        public override void OnEnter()
        {
            BaseScene.SetUpScene(this, "assets/Test/Black.png", ref sprite,
                                 16f, new Vector2(0, 0), this.Camera2D.CalcBounds().Size, new Vector2i(1, 1));

            music = new Bgm("assets/Music/dirgeloop.mp3");

            player = music.CreatePlayer();

            player.Play();


            this.RegisterDisposeOnExitRecursive();
            base.OnEnter();
        }
        public static void Initialize()
        {
            // Set up the graphics system
            graphics = new GraphicsContext();

            //Background and Foreground
            background = new BackGround(graphics);
            foreground = new Foreground(graphics);

            //added stopwatch
            clock = new Stopwatch();
            clock.Start();


            //Name the Characters
            character1        = "GoodGuy";
            character2        = "GoodGuy2";
            character3        = "Villain";
            character4        = "Villain2";
            characterName1    = "Stuper Man";
            characterName2    = "BafMan";
            characterName3    = "Lexus Luthor";
            characterName4    = "Trickster";
            isPC1             = true;
            isPC2             = true;
            isPC3             = false;
            isPC4             = false;
            UniqueIDChar1     = 0;
            UniqueIDChar2     = 1;
            UniqueIDChar3     = 0;
            UniqueIDChar4     = 1;
            totalCharacterNum = 4;

            //background Music
            Bgm bgm = new Bgm("/Application/Assets/fight.mp3");

            bgmp      = bgm.CreatePlayer();
            bgmp.Loop = true;
            bgmp.Play();


            //Creating image for Menu Screen
            imageMenu  = new Texture2D("/Application/Assets/Menu Screen.png", false);
            menuScreen = new Sprite(graphics, imageMenu);

            //setting state to Menu.
            currentState = GameState.Menu;
        }
Beispiel #19
0
        public FireNode()
        {
            fireBgm = new Bgm ("/Application/Assets/sound/fire.mp3");
            fireBgmPlayer = fireBgm.CreatePlayer();
            this.RegisterDisposeOnExit (fireBgm);
            this.RegisterDisposeOnExit (fireBgmPlayer);

            fireBgmPlayer.Loop = true;
            fireBgmPlayer.Play ();

            generateFirewallSprite ();
            generateSprite(spriteWidth, 0);
            AddChild(sprite);

            ScheduleUpdate();
        }
Beispiel #20
0
 //Play selected music from musicList
 public static bool PlayMusic(string key, bool isLooping, float volume, float playbackRate)
 {
     if (musicList.ContainsKey(key))
     {
         musicPlayer              = musicList[key].CreatePlayer();
         musicPlayer.Volume       = volume;
         musicPlayer.Loop         = isLooping;
         musicPlayer.PlaybackRate = playbackRate;
         musicPlayer.Play();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #21
0
        public static void UpdateDead()
        {
            var gamePadData = GamePad.GetData(0);

            if ((gamePadData.ButtonsDown & GamePadButtons.Start) != 0)
            {
                currentState = GameState.HighScore;
                //Disposes of game music and plays menu music
                bgmplay2.Dispose();
                Bgm bgm = new Bgm("/Application/Sounds/gamebgm.mp3");
                bgmplay      = bgm.CreatePlayer();
                bgmplay.Loop = true;
                bgmplay.Play();
            }
            updateScore = true;
        }
    // サウンド再生用メソッド(BGMの時のみループ指定、デフォではfalse)
    public void Play(SOUND_TYPE soundType, string fileName, bool loop = false)
    {
        switch (soundType)
        {
        case SOUND_TYPE.BGM:
            bgmPlayer.Play(fileName, loop);
            break;

        case SOUND_TYPE.SE:
            sePlayer.Play(fileName);
            break;

        case SOUND_TYPE.VOICE:
            voicePlayer.Play(fileName);
            break;
        }
    }
Beispiel #23
0
 public void Button_Mute_Click(object sender, RoutedEventArgs args)
 {
     if (isBgmMute)
     {
         BgmPlayer.Play();
         isBgmMute = false;
         Button_Mute_Forbid_Idle.Visibility    = Visibility.Hidden;
         Button_Mute_Forbid_Clicked.Visibility = Visibility.Hidden;
     }
     else
     {
         BgmPlayer.Pause();
         isBgmMute = true;
         Button_Mute_Forbid_Idle.Visibility    = Visibility.Visible;
         Button_Mute_Forbid_Clicked.Visibility = Visibility.Visible;
     }
 }
Beispiel #24
0
 public void play()
 {
     if (bgmPlayer == null || bgm == null)
     {
         return;
     }
     if (bgmPlayer.Status != BgmStatus.Playing)
     {
         if (bgmPlayer.Status == BgmStatus.Paused)
         {
             bgmPlayer.Resume();
         }
         else
         {
             bgmPlayer.Play();
         }
     }
 }
Beispiel #25
0
        public override void Update(float dT)
        {
            uiTime.Text  = "Time: " + ScoreManager.Instance.getTime();
            uiScore.Text = "Score: " + ScoreManager.Instance.getScore();

            foreach (Tank tank in tankList)
            {
                tank.Update(dT);
                tank.rotateTurret(player.Position(), dT);
                if (player.isTouching() && player.Collision(tank.getPosition(), tank.getSize()))
                {
                    alive = false;
                }
            }

            player.Update();
            if (player.isTouching())
            {
                ScoreManager.Instance.runScore();
                if (bgSoundPlayer.Status == BgmStatus.Paused)
                {
                    bgSoundPlayer.Resume();
                }
                else if (bgSoundPlayer.Status != BgmStatus.Playing)
                {
                    bgSoundPlayer.Play();
                }
            }
            else
            {
                bgSoundPlayer.Pause();
            }


            if (!alive)
            {
                bgSoundPlayer.Dispose();
                ScoreManager.Instance.setScore();
                SceneManager.Instance.setEndScene();
            }

            Director.Instance.Update();
        }
Beispiel #26
0
        public static bool Init()
        {
            decodeStream = File.OpenRead("/Application/apple.psmvideo");

            graphics = new GraphicsContext();
            SampleDraw.Init(graphics);
            bgm       = new Bgm("/Application/apple.mp3");
            bgmPlayer = bgm.CreatePlayer();
            FrameImg  = new Image(ImageMode.Rgba, new ImageSize(480, 360), new ImageColor(0, 0, 0, 255));

            tex = createTexture(FrameImg);
            spr = new SampleSprite(tex, ((960 / 2) - 480), ((544 / 2) - 360));

            timer = new Stopwatch();
            bgmPlayer.Play();


            return(true);
        }
Beispiel #27
0
        public override void OnEnter()
        {
            worldmap = new SpriteUV();

            currentx = 0f;
            currenty = 0f;
            height   = 320f;

            SetUpWorldMap(this, "assets/WorldMap/DemoWorldMapWalls.png", ref worldmap,
                          height, new Vector2(currentx, currenty),
                          new Vector2i(1, 1));

            SetUpMapPieces(minePieces, mineDrillPieces, lumberMillPieces, strongHoldPieces, ref mineSheetTextureInfo, ref lumbermillSheetTextureInfo, ref strongHoldAndMineSheetTextureInfo);

            SetMineDrillPiecesInMineDrillList(mineSheetTextureInfo, ref mineDrillList, ref mineDrillPieces, .059f);

            SetLumberMillPiecesInLumberMillList(lumbermillSheetTextureInfo, ref lumberMillList, ref lumberMillPieces, .059f);

            SetMinePiecesInMineList(strongHoldAndMineSheetTextureInfo, ref mineAndStrongHoldList, ref minePieces, .059f);

            SetStrongHoldPiecesInStrongHoldList(strongHoldAndMineSheetTextureInfo, ref mineAndStrongHoldList, ref strongHoldPieces, .059f);

            music   = new Bgm("assets/Music/loop.mp3");
            boombox = music.CreatePlayer();
            boombox.Play();



            this.AddChild(mineAndStrongHoldList);

            this.AddChild(lumberMillList);

            this.AddChild(mineDrillList);

            this.ScheduleUpdate();
            this.RegisterDisposeOnExitRecursive();


            base.OnEnter();
        }
Beispiel #28
0
        public EndScene()
        {
            _waitTimer = new Timer();
            ScheduleUpdate();
            _sceneCamera = (Camera2D)Camera;
            Vector2 ideal_screen_size = new Vector2(960.0f, 544.0f);
            _sceneCamera.SetViewFromHeightAndCenter(ideal_screen_size.Y, ideal_screen_size / 2.0f);

            _groundLayer = new Layer(_sceneCamera);

            Animations = new Dictionary<string, Animation>();
            var texInfo = new TextureInfo(AssetManager.GetTexture("catanimation"), new Vector2i(5,1),TRS.Quad0_1);
            _currentAnimation = new Animation(0, 5, 0.1f, false);
            _currentAnimation.Play();

            _cat = new SpriteTile(texInfo);
            _cat.TileIndex1D = _currentAnimation.CurrentFrame;
            _cat.Quad.S = new Vector2(258, 214);
            _cat.CenterSprite();
            _cat.Position = new Vector2(_sceneCamera.CalcBounds().Point00.X, _sceneCamera.CalcBounds().Point00.Y + _cat.TextureInfo.TextureSizef.Y/2 +64 );

            var background = new SpriteTile(new TextureInfo(AssetManager.GetTexture("background_paper")));
            background.Quad.S = background.TextureInfo.TextureSizef;
            background.CenterSprite();
            background.Position = _sceneCamera.CalcBounds().Center;

            for(var i = 0; i < 5; i++)
            {
                var _sprite = new GroundTile(new TextureInfo(AssetManager.GetTexture("ground_tile")));
                _groundLayer.AddChild(_sprite);
                _sprite.Quad.S = _sprite.TextureInfo.TextureSizef;
                _sprite.Position = new Vector2(_sceneCamera.CalcBounds().Point00.X + i * _sprite.TextureInfo.TextureSizef.X, _sceneCamera.CalcBounds().Point00.Y - _sprite.TextureInfo.TextureSizef.Y / 2);
            }
            _musicPlayer = AssetManager.GetBGM("endscreen").CreatePlayer();
            _musicPlayer.Play();
            AddChild(background);
            AddChild (_cat);
            AddChild (_groundLayer);
        }
Beispiel #29
0
    public virtual int PlayMusic(String path, int flags)
    {
        StopMusic();

        _music = BBPsmGame.PsmGame().LoadBgm(path);
        if (_music == null)
        {
            return(-1);
        }

        _musicPlayer = _music.CreatePlayer();
        if (_musicPlayer == null)
        {
            _music = null;
            return(-1);
        }

        _musicPlayer.Loop   = (flags & 1) != 0;
        _musicPlayer.Volume = _musicVolume;
        _musicPlayer.Play();

        return(-1);
    }
Beispiel #30
0
        public TitleScene()
        {
            ScheduleUpdate();
            _nextSequence = false;
            _sleepTimer = new Timer();

            _sceneCamera = (Camera2D)Camera;
            Vector2 ideal_screen_size = new Vector2(960.0f, 544.0f);
            _titleBackground = new SpriteTile(new TextureInfo(AssetManager.GetTexture("titlescreen")));
            _titleBackground.Quad.S = _titleBackground.TextureInfo.TextureSizef;
            _titleBackground.CenterSprite();
            _sceneCamera.SetViewFromHeightAndCenter(ideal_screen_size.Y, ideal_screen_size / 2.0f);

            var kid = new SpriteTile(new TextureInfo(AssetManager.GetTexture("kid")));
            kid.Quad.S = kid.TextureInfo.TextureSizef;
            kid.CenterSprite();
            kid.Position = _sceneCamera.CalcBounds().Center;

            _musicPlayer = AssetManager.GetBGM("title").CreatePlayer();
            _musicPlayer.Play();
            _titleBackground.Position = _sceneCamera.CalcBounds().Center;
            AddChild(kid);
            AddChild(_titleBackground);
        }
Beispiel #31
0
        private static void Initialize()
        {
            graphics = new GraphicsContext();

            //Initialize textures only once for their load
            bossTex  = new Texture2D("Application/Assets/Boss.png", false);
            dumbTex  = new Texture2D("Application/Assets/Fire_Ball.png", false);
            lockTex  = new Texture2D("Application/Assets/Copter.png", false);
            sent1Tex = new Texture2D("Application/Assets/Sentry.png", false);
            sent3Tex = new Texture2D("Application/Assets/sentryexclaimation.png", false);
            projBTex = new Texture2D("Application/Assets/basicproj.png", false);
            projFTex = new Texture2D("Application/Assets/flameproj.png", false);
            projLTex = new Texture2D("Application/Assets/lazerproj.png", false);
            wpnBTex  = new Texture2D("Application/Assets/Pistol.png", false);
            wpnFTex  = new Texture2D("Application/Assets/Flamethrower2.png", false);
            wpnLTex  = new Texture2D("Application/Assets/LaserBeam.png", false);

            rand = new Random();

            //Screens
            startScr      = new Sprite(graphics, new Texture2D("Application/Assets/startscreen.png", false));
            directionsScr = new Sprite(graphics, new Texture2D("Application/Assets/directionsscreen.png", false));
            endScr        = new Sprite(graphics, new Texture2D("Application/Assets/byescreen.png", false));
            highScr       = new Sprite(graphics, new Texture2D("Application/Assets/highscores.png", false));
            enterScr      = new Sprite(graphics, new Texture2D("Application/Assets/enterscorescreen.png", false));

            //Sounds
            Bgm bgm = new Bgm("/Application/Assets/intro.mp3");

            bgmp      = bgm.CreatePlayer();
            bgmp.Loop = true;
            bgmp.Play();

            //Major components
            player      = new Player(graphics);
            wpn         = new WeaponBasic(graphics);
            enemies     = new List <Enemy>();
            projectiles = new List <Projectile>();
            testers     = new List <Sprite>();        //*x for visually testing hitboxes

            //Create portal
            Texture2D t = new Texture2D("Application/Assets/portal.png", false);

            portal            = new Sprite(graphics, t);
            portal.Position.X = (graphics.Screen.Rectangle.Width / 2)
                                - (portal.Width / 2);
            portal.Position.Y = (graphics.Screen.Rectangle.Height / 2)
                                - (portal.Height / 2);

            //Create portal projectile shield
            t                = new Texture2D("Application/Assets/shine.png", false);
            shine            = new Sprite(graphics, t);
            shine.Position.X = (graphics.Screen.Rectangle.Width / 2)
                               - (shine.Width / 2);
            shine.Position.Y = (graphics.Screen.Rectangle.Height / 2)
                               - (shine.Height / 2);

            //PausedScreen sprite setup
            pauseScr = new Sprite(graphics, new Texture2D("Application/Assets/pausedscreen.png", false));
            pauseScr.SetColor(1f, 1f, 1f, .4f);

            //Add Item pickups
            flamethrower            = new Sprite(graphics, wpnFTex);
            flamethrower.Position.X = (graphics.Screen.Rectangle.Width / 3)
                                      - (flamethrower.Width / 2);
            flamethrower.Position.Y = (graphics.Screen.Rectangle.Height / 3)
                                      - (flamethrower.Height / 2);
            flameBox = new Rectangle(flamethrower.Position.X, flamethrower.Position.Y, flamethrower.Width, flamethrower.Height);

            lazer            = new Sprite(graphics, wpnLTex);
            lazer.Position.X = (graphics.Screen.Rectangle.Width * 2 / 3) + rand.Next(-100, 101)
                               - (lazer.Width / 2);
            lazer.Position.Y = (graphics.Screen.Rectangle.Height * 2 / 3) + rand.Next(100, 101)
                               - (lazer.Height / 2);
            lazerBox = new Rectangle(lazer.Position.X, lazer.Position.Y, lazer.Width, lazer.Height);

            //Start clock
            clock = new Stopwatch();
            clock.Start();

            //Initialize UI
            UISystem.Initialize(graphics);
            sceneGame = new Scene();

            label1            = new Label();
            label1.X          = 20;
            label1.Y          = 10;
            label1.Width      = 1000;
            label1.Text       = "Score: " + score;
            initialL1FontSize = label1.Font.Size;
            initialL1Height   = label1.Height;
            label1.TextColor  = new UIColor(1f, .25f, .25f, 1f);
            sceneGame.RootWidget.AddChildLast(label1);

            label2            = new Label();
            label2.X          = 20;
            label2.Y          = graphics.Screen.Height - 40;
            label2.Width      = 800;
            label2.Text       = "Health: " + player.Health;
            initialL2FontSize = label2.Font.Size;
            initialL2Height   = label2.Height;
            initialL2Y        = label2.Y;
            label2.TextColor  = new UIColor(1f, .25f, .25f, 1f);
            sceneGame.RootWidget.AddChildLast(label2);

            sceneScores = new Scene();

            label3         = new Label();
            label3.X       = 333;
            label3.Y       = 400;
            label3.Width   = 600;
            label3.Height += 35;

            try
            {
                StreamReader sr    = new StreamReader("/Documents/highscores.txt");
                string       tempS = sr.ReadLine();
                if (tempS.Length > 0)
                {
                    hiScore     = Double.Parse(tempS.Substring(3));
                    label3.Text = tempS.Substring(0, 3) + ": " + hiScore;
                }
                else
                {
                    label3.Text = "No High Score, Yet!";
                }
                sr.Close();
            }
            catch (FileNotFoundException)
            {
                label3.Text = "File Not Found!";
            }

            label3.Font.Size += 30;
            label3.TextColor  = new UIColor(0f, 0f, 0f, 1f);
            sceneScores.RootWidget.AddChildLast(label3);

            sceneHiScore = new Scene();

            label4            = new Label();
            label4.X          = 550;
            label4.Y          = 400;
            label4.Width      = 500;
            label4.Height    += 18;
            label4.Font.Size += 30;
            label4.Text       = "A";
            label4.TextColor  = new UIColor(0f, 0f, 0f, 1f);
            sceneHiScore.RootWidget.AddChildLast(label4);

            UISystem.SetScene(sceneGame, null);

            //*x tester = new Sprite (graphics, projBTex);
        }
Beispiel #32
0
 public static void PlayStage1boss()
 {
     bgmPlayer.Dispose();
     bgmPlayer = stage1boss.CreatePlayer();
     bgmPlayer.Loop = true;
     bgmPlayer.Play();
 }
Beispiel #33
0
 public static void PlayTitle()
 {
     bgmPlayer.Dispose();
     bgmPlayer = title.CreatePlayer();
     bgmPlayer.Loop = true;
     bgmPlayer.Play();
 }
Beispiel #34
0
        public GamePlayScene()
        {
            this.ScheduleUpdate ();
            _garnishTimer = new Timer();
            _groundTimer = new Timer();
            _waterLevel = 272;
            _groundLevel = 120;
            _random = new Random();
            _garnishDelay = _random.Next(0,5);

            Vector2 ideal_screen_size = new Vector2(960.0f, 544.0f);
            SceneCamera = (Camera2D)Camera;

            SceneCamera.SetViewFromHeightAndCenter(ideal_screen_size.Y, ideal_screen_size / 2.0f);

            _groundGarnish = new Layer(SceneCamera);
            _mainLayer = new Layer(SceneCamera);
            _playerCreature = new PlayerCreature ();
            _playerCreature.sprite.Position = Camera.CalcBounds ().Center;
            _mainLayer.AddChild (_playerCreature.sprite);

            _backgroundLayer = new Layer(SceneCamera, 0, 0);
            var background = new SpriteTile(new TextureInfo(AssetManager.GetTexture("background_paper")));
            _backgroundLayer.AddChild(background);
            background.Quad.S = background.TextureInfo.TextureSizef;
            background.CenterSprite();
            background.Position = SceneCamera.CalcBounds().Center;

            _water = new SpriteTile(new TextureInfo(AssetManager.GetTexture("water")));
            _water.Quad.S = _water.TextureInfo.TextureSizef;
            _water.CenterSprite();
            _water.Position = SceneCamera.CalcBounds().Center + new Vector2(0, -244);

             _waterTop = new WaterTile(new TextureInfo(AssetManager.GetTexture("waveline")));
            _waterTop.Quad.S = _waterTop.TextureInfo.TextureSizef;
            _waterTop.CenterSprite();
            _waterTop.Position = _water.Position + new Vector2(0 ,_water.TextureInfo.TextureSizef.Y /2 );
            _waterTop.Position = SceneCamera.CalcBounds().Center + new Vector2(0, -244 + _water.TextureInfo.TextureSizef.Y/2f);

            _groundLayer = new Layer(SceneCamera, 1, 1);
            _groundGarnish = new Layer(SceneCamera, 1, 1);

            var texInfo = new TextureInfo(AssetManager.GetTexture ("ground_tile"));
            _ground = new SpriteList(texInfo);
            _sprite = new SpriteTile(texInfo);
            _ground.AddChild(_sprite);
            _sprite.Quad.S = texInfo.TextureSizef;
            _sprite.CenterSprite();
            _sprite.TileIndex2D = new Vector2i(0,0);

            GenerateMap();

            _enemies = new List<Enemy>();
            _bullets = new List<Bullet>();
            /*
            // enemy sprite test code
            var fish0 = new FishEnemy (new Vector2 (30.0f, 30.0f), _playerCreature);
            var fish1 = new FishEnemy (new Vector2 (15.0f, 15.0f), _playerCreature);
            var fish2 = new FishEnemy (new Vector2 (100.0f, 70.0f), _playerCreature);

            _enemies.Add (fish0);
            _enemies.Add (fish1);
            _enemies.Add (fish2);
            */
            var dummyFish = new FishEnemy (new Vector2 (-25.0f, -25.0f), _playerCreature);
            dummyFish.sprite.UnscheduleAll();
            _mainLayer.AddChild (FishEnemy.spriteList);

            var dummyBullet = new Bullet(new Vector2(-25.0f,-25.0f));
            dummyBullet.sprite.UnscheduleAll();
            //dummyBullet.sprite.Visible = false;
            _mainLayer.AddChild(Bullet.spriteList);

            _waterLayer = new Layer(SceneCamera);
            _waterLayer.AddChild(_water);
            _waterLayer.AddChild(_waterTop);

            _musicPlayer = AssetManager.GetBGM("gameplaymusic").CreatePlayer();
            _musicPlayer.Loop = true;
            _musicPlayer.Play();

            AddChild (_backgroundLayer);

            AddChild (_mainLayer);
            AddChild(_groundLayer);
            AddChild(_groundGarnish);
            AddChild(_waterLayer);

            _eventManager = new EventManager(_mainLayer,_playerCreature);
        }
Beispiel #35
0
 public void AudioPlay()
 {
     bgm = new Bgm(OutputDir + "/" + fileName + ".mp3");
     bgmPlayer = bgm.CreatePlayer();
     bgmPlayer.Volume = 1.0F;
     bgmPlayer.Play();
 }
Beispiel #36
0
        // 初期化
        public void Initialize()
        {
            // GameEngine2D 画面クリアー色の設定
            Director.Instance.GL.Context.SetClearColor (Colors.Grey20);

            // 画面解像度情報
            //			ScreenSize = new Vector2i (854, 480);
            ScreenSize = new Vector2i (960, 544);

            // 効果音の設定
            var soundObj = new Sound ("/Application/assets/se.wav");
            Sound = soundObj.CreatePlayer ();

            // BGMの設定
            bgm = new Bgm ("/Application/assets/bgm.mp3");
            player = bgm.CreatePlayer ();
            player.Loop = true; // リピート再生する
            // BGMの再生
            player.Play ();

            // シーン生成(ノードのルートになる)
            var scene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene ();

            // 2Dゲーム向けにカメラを設定
            scene.Camera.SetViewFromViewport ();

            // GameEngine2Dを実行
            Director.Instance.RunWithScene (scene, true);

            Pause = false;

            World = new Node ();
            //	Interface = new Node ();
            // シーンにWorldを追加する
            scene.AddChild (World);
            // シーンにInterface(UIで利用する)を追加する
            //	scene.AddChild (Interface);

            // 背景登録
            for (int y = 0; y < 7; y++) {
                for (int x = 0; x < 6; x++) {
                    var backGround = new BackGround (new Vector2 (x * 192, y * 128));
                    World.AddChild (backGround);
                }
            }

            // 自機(プレイヤー)登録
            Player = new Player (new Vector2 (Game.Instance.ScreenSize.X/2, 100));
            World.AddChild (Player);
            // 敵機(ボス)登録
            Boss = new Boss (new Vector2 (Game.Instance.ScreenSize.X/2, 250));
            World.AddChild (Boss);
            // UI登録
            UI = new UI ();
            //Interface.AddChild (UI);
            scene.AddChild (UI);
            // 当たり判定処理の生成
            HitTest = new HitTest ();
            // 登録キュー
            AddQueue = new List<GameEntity> ();
            // 削除キュー
            RemoveQueue = new List<GameEntity> ();
        }
Beispiel #37
0
        public static void Update()
        {
            var gamePadData = GamePad.GetData(0);

            //tester.Position.X = dat.X;
            //tester.Position.Y = dat.Y;

            //Menu Handling
            if (start || directions || enterscore || highscore || end)
            {
                menuBuffer++;
                if (start)
                {
                    if ((gamePadData.Buttons & GamePadButtons.Square) != 0 &&                //need != 0?
                        menuBuffer >= MENU_INPUT_BUFFER)
                    {
                        start      = false;
                        directions = true;
                        menuBuffer = 0;
                    }
                    if ((gamePadData.Buttons & GamePadButtons.Cross) != 0 &&
                        menuBuffer >= MENU_INPUT_BUFFER)
                    {
                        start = false;
                        game  = true;

                        menuBuffer = 0;
                        score      = 0;
                        difficulty = 0;
                        player     = new Player(graphics);
                        died       = false;
                        paused     = false;
                        for (int i = enemies.Count - 1; i >= 0; i--)
                        {
                            enemies.RemoveAt(i);
                        }
                        for (int i = projectiles.Count - 1; i >= 0; i--)
                        {
                            projectiles.RemoveAt(i);
                        }
                        gotFlame = false;
                        gotLazer = false;
                        wpn      = new WeaponBasic(graphics);

                        if (!gameMusic)
                        {
                            bgmp.Dispose();
                            Bgm bgm1 = new Bgm("/Application/Assets/playstate.mp3");
                            bgmp1      = bgm1.CreatePlayer();
                            bgmp1.Loop = true;
                            bgmp1.Play();
                            gameMusic = true;
                        }
                    }
                    if ((gamePadData.Buttons & GamePadButtons.Circle) != 0 &&
                        menuBuffer >= MENU_INPUT_BUFFER)
                    {
                        start      = false;
                        highscore  = true;
                        menuBuffer = 0;
                        UISystem.SetScene(sceneScores, null);
                    }
                    if ((gamePadData.Buttons & GamePadButtons.Start) != 0 &&
                        menuBuffer >= MENU_INPUT_BUFFER)
                    {
                        start      = false;
                        end        = true;
                        menuBuffer = 0;
                    }
                }
                if (directions)
                {
                    if ((gamePadData.Buttons & GamePadButtons.Square) != 0 &&
                        menuBuffer >= MENU_INPUT_BUFFER)
                    {
                        directions = false;
                        start      = true;
                        menuBuffer = 0;
                    }
                }
                if (highscore)
                {
                    if ((gamePadData.Buttons & GamePadButtons.Square) != 0 &&
                        menuBuffer >= MENU_INPUT_BUFFER)
                    {
                        highscore  = false;
                        start      = true;
                        menuBuffer = 0;
                        UISystem.SetScene(sceneGame, null);
                    }
                    if ((gamePadData.Buttons & GamePadButtons.Start) != 0 &&
                        menuBuffer >= MENU_INPUT_BUFFER)
                    {
                        highscore  = false;
                        end        = true;
                        menuBuffer = 0;
                        UISystem.SetScene(sceneGame, null);
                    }
                }
                if (enterscore)
                {
                    if ((gamePadData.Buttons & GamePadButtons.Up) != 0 &&
                        menuBuffer >= MENU_INPUT_BUFFER - 22)
                    {
                        if (label4.Text.Length == 1)
                        {
                            if (!label4.Text.Equals("z", StringComparison.OrdinalIgnoreCase))                            //look into why the oridinal ignore case
                            {
                                label4.Text = ((char)(label4.Text.ToCharArray()[0] + 1)).ToString().ToUpper();
                            }
                            else
                            {
                                label4.Text = "A";
                            }
                        }
                        else
                        if (label4.Text.Length == 2)
                        {
                            if (!label4.Text.Substring(1).Equals("z", StringComparison.OrdinalIgnoreCase))
                            {
                                label4.Text = label4.Text.Substring(0, 1) + ((char)(label4.Text.ToCharArray()[1] + 1)).ToString().ToUpper();
                            }
                            else
                            {
                                label4.Text = label4.Text.Substring(0, 1) + "A";
                            }
                        }
                        else
                        if (label4.Text.Length == 3)
                        {
                            if (!label4.Text.Substring(2).Equals("z", StringComparison.OrdinalIgnoreCase))
                            {
                                label4.Text = label4.Text.Substring(0, 2) + ((char)(label4.Text.ToCharArray()[2] + 1)).ToString().ToUpper();
                            }
                            else
                            {
                                label4.Text = label4.Text.Substring(0, 2) + "A";
                            }
                        }
                        menuBuffer = 0;
                    }
                    if ((gamePadData.Buttons & GamePadButtons.Down) != 0 &&
                        menuBuffer >= MENU_INPUT_BUFFER - 22)
                    {
                        if (label4.Text.Length == 1)
                        {
                            if (!label4.Text.Equals("a", StringComparison.OrdinalIgnoreCase))
                            {
                                label4.Text = ((char)(label4.Text.ToCharArray()[0] - 1)).ToString().ToUpper();
                            }
                            else
                            {
                                label4.Text = "Z";
                            }
                        }
                        if (label4.Text.Length == 2)
                        {
                            if (!label4.Text.Substring(1).Equals("a", StringComparison.OrdinalIgnoreCase))
                            {
                                label4.Text = label4.Text.Substring(0, 1) + ((char)(label4.Text.ToCharArray()[1] - 1)).ToString().ToUpper();
                            }
                            else
                            {
                                label4.Text = label4.Text.Substring(0, 1) + "Z";
                            }
                        }
                        if (label4.Text.Length == 3)
                        {
                            if (!label4.Text.Substring(2).Equals("a", StringComparison.OrdinalIgnoreCase))
                            {
                                label4.Text = label4.Text.Substring(0, 2) + ((char)(label4.Text.ToCharArray()[2] - 1)).ToString().ToUpper();
                            }
                            else
                            {
                                label4.Text = label4.Text.Substring(0, 2) + "Z";
                            }
                        }
                        menuBuffer = 0;
                    }
                    if ((gamePadData.Buttons & GamePadButtons.Cross) != 0 &&
                        menuBuffer >= MENU_INPUT_BUFFER - 20)
                    {
                        if (hiScore == (score - score % .01))
                        {
                            highscore  = true;
                            enterscore = false;
                            UISystem.SetScene(sceneScores);

                            try
                            {
                                StreamReader sr    = new StreamReader("/Documents/highscores.txt");
                                string       tempS = sr.ReadLine();
                                hiScore     = Double.Parse(tempS.Substring(3));
                                label3.Text = tempS.Substring(0, 3) + ": " + hiScore;
                                sr.Close();
                            }
                            catch (FileNotFoundException)
                            {
                                label3.Text = "File Not Found!";
                            }

                            label4.Text       = "A";
                            label4.Font.Size += 15;
                        }
                        if (label4.Text.Length < 3)
                        {
                            label4.Text += "A";
                        }
                        else
                        {
                            try
                            {
                                StreamWriter sw = new StreamWriter("/Documents/highscores.txt");
                                sw.WriteLine(label4.Text + (score - score % .01));
                                hiScore = score - score % .01;
                                sw.Close();
                                label4.Font.Size -= 15;
                                label4.Text       = "Entered! Press (s)";
                            }
                            catch (FileNotFoundException)
                            {
                                label4.Font.Size -= 10;
                                label4.Text       = "File not Found! Highscore not saved!";
                            }
                        }
                        menuBuffer = 0;
                    }
                }
                if (end)
                {
                    if ((gamePadData.Buttons & GamePadButtons.Start) != 0 &&
                        menuBuffer >= MENU_INPUT_BUFFER)
                    {
                        exit       = true;
                        menuBuffer = 0;
                    }
                }
            }             //end menu
            else
            {
                //Keeps you from pause spamming via 25-frame buffer
                pauseFrameBuffer++;

                if ((gamePadData.Buttons & GamePadButtons.Select) != 0 &&
                    pauseFrameBuffer >= 25)
                {
                    pauseFrameBuffer = 0;

                    if (paused == false)
                    {
                        paused = true;
                    }
                    else
                    {
                        paused = false;
                    }
                }

                if ((gamePadData.Buttons & GamePadButtons.Start) != 0)
                {
                    end = true;
                }

                if (died && !paused)
                {
                    start = true;
                }

                if (paused)
                {
                    if (label1.Font.Size < initialL1FontSize + 30)                    //font constants
                    {
                        label1.Font.Size += 3;
                    }

                    if (label1.Height < initialL1Height + 18)
                    {
                        label1.Height += 1.8f;
                    }

                    if (label2.Font.Size < initialL2FontSize + 30)
                    {
                        label2.Font.Size += 3;
                    }

                    if (label2.Height < initialL2Height + 18)
                    {
                        label2.Height += 1.8f;
                    }

                    if (label2.Y > initialL2Y - 24)
                    {
                        label2.Y -= 2.4f;
                    }
                }


                if (game && !paused)
                {
                    //Add Time Score
                    score += deltaTime / 500.0;
                    //Increase Difficulty and recaculate spawn times
                    difficulty += 0.5;
                    if (DESpawnRate > 150)
                    {
                        DESpawnRate = -0.2642 * difficulty + 755.9524;
                    }
                    if (LOSpawnRate > 300)
                    {
                        LOSpawnRate = -0.4628 * difficulty + 3000.5714;
                    }
                    if (SESpawnRate > 300)
                    {
                        SESpawnRate = -0.9358 * difficulty + 6907.1429;
                    }
                    if (BESpawnRate > 12500)
                    {
                        BESpawnRate = -0.9643 * difficulty + 34285.7143;
                    }


                    //Checks for picking up the Flamethrower
                    if (!gotFlame && distanceSquared(player.X + player.Area.Width / 2, flameBox.Position.X + flameBox.Width / 2,
                                                     player.Y + player.Area.Height / 2, flameBox.Position.Y + flameBox.Height / 2)
                        < Math.Pow(player.HitBox + flameBox.Height / 2, 2))
                    {
                        gotFlame = true;
                        score   += 1000;
                    }                     //etc
                    if (!gotLazer && distanceSquared(player.X + player.Area.Width / 2, lazerBox.Position.X + lazerBox.Width / 2,
                                                     player.Y + player.Area.Height / 2, lazerBox.Position.Y + lazerBox.Height / 2)
                        < Math.Pow(player.HitBox + lazerBox.Height / 2, 2))
                    {
                        gotLazer = true;
                        score   += 1000;
                    }

                    //Check for weapon change
                    changeWeapons(gamePadData);

                    //Spawn Enemies
                    createEnemies();

                    //Update Player
                    player.Update(gamePadData, deltaTime);

                    //Update Weapon in use
                    wpn.Update(player.X, player.Y, (int)player.Direction, gamePadData, deltaTime);

                    //This handles the creation of projectiles from the weapon.
                    if (wpn.MakeShot && distanceSquared(player.X + player.Area.Width / 2, shine.Position.X + shine.Width / 2,
                                                        player.Y + player.Area.Height / 2, shine.Position.Y + shine.Height / 2)
                        > Math.Pow(player.HitBox + shine.Height / 2, 2))
                    {
                        if (wpn is WeaponBasic)
                        {
                            projectiles.Add(new ProjectileBasic(graphics, wpn.X, wpn.Y, wpn.Direction, projBTex));
                        }
                        if (wpn is WeaponFlame)
                        {
                            projectiles.Add(new ProjectileFlame(graphics, wpn.X, wpn.Y, wpn.Direction, projFTex));
                        }
                        if (wpn is WeaponLazer)
                        {
                            projectiles.Add(new ProjectileLazer(graphics, wpn.X, wpn.Y, wpn.Direction, projLTex));
                        }

                        wpn.MakeShot = false;
                    }

                    //Collision checking
                    checkForCollisions();

                    //Handle enemy updates and deletes
                    updateLists();

                    //Label updates and normalization
                    label1.Text = "Score: " + (score - score % 1);

                    if (label1.Font.Size > initialL1FontSize)
                    {
                        label1.Font.Size -= 3;
                    }

                    if (label1.Height > initialL1Height)
                    {
                        label1.Height -= 1.8f;
                    }

                    label2.Text = "Health: " + player.Health;

                    if (label2.Font.Size > initialL2FontSize)
                    {
                        label2.Font.Size -= 3;
                    }

                    if (label2.Height > initialL2Height)
                    {
                        label2.Height -= 1.8f;
                    }

                    if (label2.Y < initialL2Y)
                    {
                        label2.Y += 2.4f;
                    }
                }

                //When paused, show more detailed score
                if (paused)
                {
                    label1.Text = "Score: " + (score - score % .01);
                }

                //End of Game Scenario
                if (player.Delete)
                {
                    paused = true;
                    if (score > hiScore)
                    {
                        enterscore  = true;
                        label1.Text = "Final Score: " + (score - score % .01);
                        label2.Text = "You got the High Score! (z) to Enter Initials!";
                        UISystem.SetScene(sceneHiScore, null);
                    }
                    else
                    {
                        died        = true;
                        label1.Text = "Final Score: " + (score - score % .01);
                        label2.Text = "You have died! (z) to Main Menu.";
                    }
                }
            }
        }
 //BGM
 public void PlayBgm(string key)
 {
     _bgmPlayer.Play(key);
 }
Beispiel #39
0
        public static void Initialize()
        {
            //Initializing variables
            graphics     = new GraphicsContext();
            eTex         = new Texture2D("/Application/Assets/enemyship.png", false);
            egreenTex    = new Texture2D("/Application/Assets/enemyshipgreen.png", false);
            eblueTex     = new Texture2D("/Application/Assets/enemyshipblue.png", false);
            pTex         = new Texture2D("/Application/Assets/starshipsmall.png", false);
            mTex         = new Texture2D("/Application/Assets/missle2.png", false);
            lTex         = new Texture2D("/Application/Assets/laser.png", false);
            sTex         = new Texture2D("/Application/Assets/laser.png", false);
            powTex       = new Texture2D("/Application/Assets/powerupspreadsmall.png", false);
            ebTex        = new Texture2D("/Application/Assets/enemybullet.png", false);
            menuTex      = new Texture2D("/Application/Assets/gamestart.png", false);
            backTex      = new Texture2D("/Application/Assets/game1back_2.png", false);
            instTex      = new Texture2D("/Application/Assets/instructions.png", false);
            scoreTex     = new Texture2D("/Application/Assets/highscores.png", false);
            creditsTex   = new Texture2D("/Application/Assets/credits.png", false);
            pauseTex     = new Texture2D("/Application/Assets/pause.png", false);
            deadTex      = new Texture2D("/Application/Assets/dead.png", false);
            running      = true;
            screenheight = graphics.Screen.Height;
            red          = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
            green        = new Vector4(0.0f, 1.0f, 0.0f, 1.0f);
            blue         = new Vector4(0.0f, 0.0f, 1.0f, 1.0f);
            gen          = new Random();
            timer        = new Stopwatch();
            timer.Start();
            startTime         = 0;
            stopTime          = 0;
            highscores        = new string[5];
            weaponOffset      = new Vector3(50, 10, 0);
            highScoreNums     = new List <int>();
            highScoreNames    = new List <string>();
            currentState      = GameState.Menu;
            menuBackground    = new Background(graphics, menuTex);
            instBackground    = new Background(graphics, instTex);
            scoreBackground   = new Background(graphics, scoreTex);
            creditsBackground = new Background(graphics, creditsTex);
            pauseBackground   = new Background(graphics, pauseTex);
            deadBackground    = new Background(graphics, deadTex);
            menuDisplay       = new MenuDisplay(graphics);
            updateScore       = false;
            updateScoreS      = false;
            alphabet          = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            currentChar       = alphabet[0];
            currentInd        = 0;
            Bgm bgm = new Bgm("/Application/Sounds/gamebgm.mp3");

            bgmplay      = bgm.CreatePlayer();
            bgmplay.Loop = true;
            bgmplay.Play();
            Sound missleSound;

            missleSound = new Sound("/Application/Sounds/misslelaunch.wav");
            missleSP    = missleSound.CreatePlayer();
            Sound explosionSound;
            Sound laserSound;

            explosionSound = new Sound("/Application/Sounds/explosion.wav");
            explosionSP    = explosionSound.CreatePlayer();
            laserSound     = new Sound("/Application/Sounds/se_tan00.wav");
            laserSP        = laserSound.CreatePlayer();
        }
Beispiel #40
0
 /// <summary>
 /// 建立音乐播放器
 /// </summary>
 public void CreatMusicPlayer(Bgm music)
 {
     MusicPlayer = music.CreatePlayer();
     MusicPlayer.Volume = 0;
     MusicPlayer.Loop = musicLoop;
     MusicPlayer.Play();
 }
Beispiel #41
0
        public static void Initialize()
        {
            clock = new Stopwatch();
            clock.Start();

            backgroundMusic = new Bgm("/Application/assets/music.mp3");
            backgroundPlayer = backgroundMusic.CreatePlayer();
            backgroundPlayer.Loop = true;
            backgroundPlayer.Play();

            presentSound = new Sound("/Application/assets/jinglebell.wav");
            presentSoundPlayer = presentSound.CreatePlayer();

            isPlaying = true;

            // Set up the graphics system
            graphics = new GraphicsContext ();
            gen= new Random();

            NewGame(0);

            currentGameState = GameState.Menu;
            menuDisplay = new MenuDisplay(graphics);
        }
Beispiel #42
0
        /// BGMの再生
        public void PlayBgm( BgmId id, bool loop )
        {
            StopBgm();

            bgmPlayer = bgmList[(int)id].CreatePlayer();
            bgmPlayer.Loop = loop;
            bgmPlayer.Play();
            bgmPlayer.Volume = 0.1f;
        }
Beispiel #43
0
 /// <summary>
 /// 播放BGM,默认循环播放
 /// </summary>
 /// <param name="bgmName">文件名</param>
 public static void PlayBGM(string bgmName)
 {
     _bgmPlayer.Play(bgmName);
 }