예제 #1
0
 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;
     }
 }
예제 #2
0
 public void DoDamage(PlayerUnit target)
 {
     if (target.State == PlayerUnit.PlayerState.Dead)
     {
         return;
     }
     target.Life.Count = target.Life.Count - 1;
 }
예제 #3
0
파일: World.cs 프로젝트: rinat/battle
 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();
 }
예제 #4
0
 public VisualPlayerUnit(PlayerUnit playerUnit, SpriteAnimation spriteAnimation)
 {
     PlayerUnit = playerUnit;
     MovementAnimation = spriteAnimation;
 }
예제 #5
0
파일: WorldView.cs 프로젝트: rinat/battle
 private void DrawPlayer(Canvas2D canvas, PlayerUnit unit)
 {
     if (unit != null)
     {
         var visualUnit = (VisualUnit)unit.UserData;
         visualUnit.Render(canvas, m_renderer);
     }
 }