public override void Update(GameTime gameTime)
{
if (!pause)
{
p.Update(gameTime, new List<Dynamic>() { p1, p2 }, new List<GameObject>() { p1, p2, p1.GetPunch(), p2.GetPunch(), w1, w2 });
p1.Update(gameTime);
p2.Update(gameTime);
Texture2D tex = null;
if (p1.Health <= 0 && p2.Health <= 0)
{
// Draw
tex = Load<Texture2D>("Image/draw");
}
else if (p2.Health <= 0)
{
// P1 Wins
tex = Load<Texture2D>("Image/p1win");
}
else if (p1.Health <= 0)
{
// P2 Wins
tex = Load<Texture2D>("Image/p2win");
}
if (tex != null)
{
pause = true;
center = new Image(widthScreen / 2 - tex.Width / 2, heightScreen / 2 - tex.Height / 2, tex);
timer = new Timer(obj => { ChangeScreen<MainMenuScreen>(); }, null, 3000, System.Threading.Timeout.Infinite);
}
}
}