Ejemplo n.º 1
0
 private static void ReduceOneLife(this GameLevel gameLevel)
 {
     Player.Current.LivesLeft--;
     gameLevel.ExitReachedCreepCount++;
     if (IsPlayerLifeLessThan20Percent())
     {
         PlaySound(GameSounds.LowHealth);
     }
     gameLevel.UpdateLife();
     gameLevel.CheckChapterCompletion();
 }
Ejemplo n.º 2
0
        private static Creep CreateAndShowCreep(this GameLevel gameLevel, CreepType type,
                                                Vector2D spawnPoint, Vector2D finalTarget)
        {
            var creep = new Creep(type, spawnPoint)
            {
                FinalTarget = finalTarget
            };

            creep.RenderModel();
            creep.IsDead += () =>
            {
                gameLevel.EarnGold((int)creep.GetStatValue("Gold"));
                gameLevel.DeadCreepCount++;
                gameLevel.CheckChapterCompletion();
            };
            creep.ReachedExit += gameLevel.ReduceOneLife;
            return(creep);
        }