//damage returneres mens denne fratrækkes Health //Healthbar sættes og farve checkes //Billeder ændres og en timer sættes //Angrebsinformation tilføjes til overbliksliste //Angrebsknapper disables private void Attack2Button_Click(object sender, RoutedEventArgs e) { int damage = Controller.Fight(f2, f1); HP1.Height = Controller.HealthBarSet(f1); Controller.AddInfoToOverview(f2, f1, damage); if (f1.Health > 0) { FighterImg1.Source = new BitmapImage(new Uri(@"./Resources/Block1.png", UriKind.Relative)); FighterImg2.Source = new BitmapImage(new Uri(@"./Resources/Attack2.png", UriKind.Relative)); CheckHealth(HP1); ButtonsEnabled(false); TimeOut(Controller.GenerateRandom(6)); } else { FighterImg1.Source = new BitmapImage(new Uri(@"./Resources/Dead1.png", UriKind.Relative)); Header.Text = String.Format("The Winner is {0}", f2.GenerateInfo()); Controller.GetFightOverview().Add(StickManStats.GenerateWinnerInfo(f2, f1)); ButtonsEnabled(false); OverviewButton.Visibility = Visibility.Visible; } }
//Returnerer vinderinformation som bruges til afsluttende overblik public static string GenerateWinnerInfo(StickManStats winner, StickManStats loser) { return(String.Format("{0} has died, and the Winner is {1}", loser.Name, winner.GenerateInfo())); }