-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameOver.cs
44 lines (38 loc) · 1.12 KB
/
GameOver.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using FNAEngine2D;
using FNAEngine2D.GameObjects;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Media;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pong
{
/// <summary>
/// GameOver
/// </summary>
public class GameOver: GameObject
{
/// <summary>
/// Loading
/// </summary>
protected override void Load()
{
Add(new Label("GAME OVER", "fonts\\Roboto-Bold", 60, this.Game.Rectangle, Color.DarkRed, TextHorizontalAlignment.Center, TextVerticalAlignment.Middle));
Add(new Button("RETRY", new Rectangle(this.Game.CenterX - 100, this.Game.CenterY + 200, 200, 60), Retry));
GetContent<SoundEffect>("sfx\\gameover").Data.Play();
MediaPlayer.Stop();
Mouse.ShowMouse();
}
/// <summary>
/// Restart the game
/// </summary>
public void Retry()
{
if(PongGame.Instance != null)
PongGame.Instance.Restart();
}
}
}