private async void enemyShot(List <Character> enemies) { foreach (Character ch in enemies) { await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => { // Wat hebben we geraakt en wat doen we ermee? if (ch is BombNPC) { addToPointGains(ch.Position, -(CurrentCharacter.Points / 5)); CurrentCharacter.Multi.Clear(); CurrentCharacter.Points -= CurrentCharacter.Points / 5; // Lose 20% of Health } else if (ch is MovingNPC || ch is NPC) { int pointGain = CurrentCharacter.Multi.Increment(); addToPointGains(ch.Position, pointGain); CurrentCharacter.Points += pointGain; } else if (ch is Item) { if (ch is StarModeItem) { CurrentCharacter.Multi.MPBonus = Multiplyer.multiplyerBonus.MULTIPLYER_X10_BONUS; CurrentCharacter.Multi.MP = 10; } else if (ch is MultiplyerEnhancerItem) { CurrentCharacter.Multi.MPBonus = Multiplyer.multiplyerBonus.DOUBLE_POINTS; } else if (ch is ShooterItem) { BulletReleaseThread.RunWorkerAsync(); } else if (ch is SpeedBoostItem) { CurrentCharacter.speedBoost(); } // Run seperate worker to set effect for 5 minutes BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += Worker_DoWork; worker.RunWorkerAsync(); } Characters.Remove(ch); }); } }