Пример #1
0
 public void Render()
 {
     if (!_playedMusic)
     {
         SoundManager.PlayMusic("bgm.mp3");
         _playedMusic = true;
     }
     Renderer.Draw("back.png", new Point());
     RenderUi(_game);
     if (_worldView == null || !_worldView.EqualsWorld(_game.World))
     {
         _worldView = new ShootingWorldView(_game.World)
         {
             Renderer = Renderer,
             SoundManager = SoundManager
         };
     }
     if (!_game.Cleared)
     {
         _worpSound = false;
         _worldView.Render(_game.World);
         if (_game.Time <= TimeSpan.FromTicks(0))
         {
             RenderTimeup(_game.Score, _game.TotalHitRatioPercent);
         }
         else if (_game.Failed)
         {
             RenderFailed();
         }
     }
     else
     {
         if (!_worpSound)
         {
             SoundManager.Play("warp.ogg");
             if (_game.BonusTime > 0)
                 SoundManager.Play("warp2.ogg");
             _worpSound = true;
         }
         _worldView.RenderWarp(_game.World);
         RenderStageClear(_game.StageNo, _game.HitRatioPercent, _game.BonusTime);
     }
 }
Пример #2
0
 public void Update(Input input)
 {
     if (input.DirectionToggled)
     {
         switch (input.Direction)
         {
             case 4:
                 _stageNo--;
                 if (_stageNo < 0)
                     _stageNo = 0;
                 _world = new ShootingWorld(
                     _stageFactory.GetEnemies(_stageNo));
                 _view = new ShootingWorldView(_world)
                 {
                     Renderer = Renderer
                 };
                 break;
             case 6:
                 _stageNo++;
                 if (_stageNo > _stageFactory.LastStage)
                 {
                     _stageFactory.AddStage();
                 }
                 _world = new ShootingWorld(
                     _stageFactory.GetEnemies(_stageNo));
                 _view = new ShootingWorldView(_world)
                 {
                     Renderer = Renderer
                 };
                 break;
         }
     }
     if (DX.CheckHitKey(DX.KEY_INPUT_1) == DX.TRUE)
     {
         int x, y;
         DX.GetMousePoint(out x, out y);
         _stageFactory.AddEnemy(
             _stageNo, EnemyType.Green, MergePoint(x, y));
         _world = new ShootingWorld(_stageFactory.GetEnemies(_stageNo));
     }
     if (DX.CheckHitKey(DX.KEY_INPUT_2) == DX.TRUE)
     {
         int x, y;
         DX.GetMousePoint(out x, out y);
         _stageFactory.AddEnemy(
             _stageNo, EnemyType.Blue, MergePoint(x, y));
         _world = new ShootingWorld(_stageFactory.GetEnemies(_stageNo));
     }
     if (DX.CheckHitKey(DX.KEY_INPUT_3) == DX.TRUE)
     {
         int x, y;
         DX.GetMousePoint(out x, out y);
         _stageFactory.AddEnemy(
             _stageNo, EnemyType.Red, MergePoint(x, y));
         _world = new ShootingWorld(_stageFactory.GetEnemies(_stageNo));
     }
     if (DX.CheckHitKey(DX.KEY_INPUT_4) == DX.TRUE)
     {
         int x, y;
         DX.GetMousePoint(out x, out y);
         _stageFactory.AddEnemy(
             _stageNo, EnemyType.Silver, MergePoint(x, y));
         _world = new ShootingWorld(_stageFactory.GetEnemies(_stageNo));
     }
     if (DX.CheckHitKey(DX.KEY_INPUT_5) == DX.TRUE)
     {
         int x, y;
         DX.GetMousePoint(out x, out y);
         _stageFactory.AddEnemy(
             _stageNo, EnemyType.Gold, MergePoint(x, y));
         _world = new ShootingWorld(_stageFactory.GetEnemies(_stageNo));
     }
     if (DX.CheckHitKey(DX.KEY_INPUT_Q) == DX.TRUE)
     {
         int x, y;
         DX.GetMousePoint(out x, out y);
         _stageFactory.RemoveEnemy(
             _stageNo, new Point((short)x, (short)y));
         _world = new ShootingWorld(_stageFactory.GetEnemies(_stageNo));
     }
     if (input.ShotToggled && input.Shot)
     {
         new File().SaveStages(_stageFactory.ToData());
     }
 }