public void Update(float monsterhealth) { if (monsterhealth > 0) { LabelHealth.Content = monsterhealth; HealthBar.Value = monsterhealth; } else { // _autoDamager.Wait(); _timer.Stop(); //Dodanie zarobionej kasy z przeciwnika var killedMonster = MonsterList.Single(x => x.Id == _currentMonsterId); var currentMoney = int.Parse(_moneyLabel.Content.ToString()); currentMoney += killedMonster.Money; _moneyLabel.Content = currentMoney; //Remove monster from the list MonsterList.RemoveAt(0); MonsterGenerator.GenerateNewMonster(); //Załaduj nowego przeciwnika. var monster = MonsterList.Single(x => x.Id == _currentMonsterId + 1); _currentMonsterId = monster.Id; LabelMonsterName.Content = monster.Name + " Lvl " + monster.Level; LabelHealth.Content = monster.Health; HealthBar.Maximum = monster.Health; HealthBar.Value = monster.Health; //TODO: Napraw crasha, który powstaje kiedy monster nie ma imagepath. Uri uri = new Uri(monster.ImagePath, UriKind.Relative); ImageSource imgSource = new BitmapImage(uri); _monsterImage.Source = imgSource; //_autoDamager.Start(monster.Health); _timer.Start(); } }