public void AcceptBonus(PlayerUnit player, BonusBase bonus) { var bonus2 = bonus as BonusBoom; if (bonus2 != null) { foreach (var enemy in player.World.Enemies) { enemy.Life.Count = 0; } if (player.Score.Count / WorldLaw.LevelUpThreshold < (player.Score.Count + player.World.Enemies.Count) / WorldLaw.LevelUpThreshold) { player.World.WorldState.LevelUp = true; } player.Score.Count += player.World.Enemies.Count; player.World.WorldState.BonusExplosion = true; return; } var bonus3 = bonus as BonusHealth; if (bonus3 != null) { player.Life.Count = player.Life.Count + 1; return; } var bonus4 = bonus as BonusLife; if (bonus4 != null) { player.Life.Count = player.Life.Count + WorldLaw.DefaultPlayerLifeCount; return; } }
public void DoDamage(PlayerUnit target) { if (target.State == PlayerUnit.PlayerState.Dead) { return; } target.Life.Count = target.Life.Count - 1; }
public void Reset() { Width = 0; Height = 0; Law = new WorldLaw(this); Player = new PlayerUnit(this); WorldState = new WorldState(this); Walls = new List<WallUnit>(); Enemies = new List<EnemyUnit>(); Bullets = new List<BulletUnit>(); Bonuses = new List<BonusBase>(); BonusProcessor = new BonusProcessor(); BulletProcessor = new BulletProcessor(); }
public VisualPlayerUnit(PlayerUnit playerUnit, SpriteAnimation spriteAnimation) { PlayerUnit = playerUnit; MovementAnimation = spriteAnimation; }
private void DrawPlayer(Canvas2D canvas, PlayerUnit unit) { if (unit != null) { var visualUnit = (VisualUnit)unit.UserData; visualUnit.Render(canvas, m_renderer); } }