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; }
private static void ReduceOneLife(this GameLevel gameLevel) { Player.Current.LivesLeft--; gameLevel.ExitReachedCreepCount++; if (IsPlayerLifeLessThan20Percent()) PlaySound(GameSounds.LowHealth); gameLevel.UpdateLife(); gameLevel.CheckChapterCompletion(); }