public ShootingWorldView(ShootingWorld world) { _world = world; _dieFrame.Add(_world.Player, 0); foreach (Enemy enemy in world.Enemies) { _dieFrame.Add(enemy, 0); enemy.Damaged += (sender, args) => _damagedEnemies.Add((Enemy)sender); } world.Cleared += (sender, args) => { _backgroundView.Warp(); }; }
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()); } }
private void CreateWorld() { if (Cleared && World != null) { _allHitCount += World.AllHitCount; _shotCountHistory += World.Player.ShotCount; } Cleared = false; Failed = false; _intervalFrame = -1; World = new ShootingWorld(_stageFactory.GetEnemies(StageNo)); World.Cleared += (sender, args) => { Cleared = true; Time += TimeSpan.FromSeconds(BonusTime); }; World.Failed += (sender, args) => Failed = true; foreach (var enemy in World.Enemies) { enemy.Damaged += (sender, args) => { switch (((Enemy)sender).Type) { case EnemyType.Silver: Score += 50; break; case EnemyType.Gold: Score += 100; break; } }; enemy.Died += (sender, args) => { var e = (Enemy)sender; int score = 0; switch (e.Type) { case EnemyType.Green: score = 100; break; case EnemyType.Blue: score = 200; break; case EnemyType.Red: score = 300; break; case EnemyType.Silver: score = 400; break; case EnemyType.Gold: score = 500; break; } if (e.State == Enemy.MovingState.SpinAttack) score *= 4; else if (e.State != Enemy.MovingState.Group) score *= 2; Score += score; }; } }
public void RenderWarp(ShootingWorld world) { _backgroundView.Render(); _warpMove -= 20; Renderer.DrawClip("remilia.png", new Point(33, 98), new Size(33, 34), GetUnitPoint(world.Player.Point.Shift(0, _warpMove))); }
public void Render(ShootingWorld world) { _backgroundView.Render(); RenderCharactors(world); }
public bool EqualsWorld(ShootingWorld world) { return _world == world; }
private void RenderCharactors(ShootingWorld world) { RenderShots(world.Shots); foreach (Enemy enemy in world.Enemies) { if (enemy.Life > 0) { RenderEnemy(enemy); } else { int frame = _dieFrame[enemy]; _dieFrame[enemy] = ++frame; RenderExplosion(enemy.Point, frame, world.Enemies.Count(x => x.Life > 0) < 10); } } Player player = world.Player; if (player.Life > 0) { Renderer.DrawClip("remilia.png", new Point(33, 98), new Size(33, 34), GetUnitPoint(player.Point)); } else { int frame = _dieFrame[player]; _dieFrame[player] = ++frame; RenderExplosion(player.Point, frame, false); } }