-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstalledGame.cs
More file actions
48 lines (39 loc) · 1.14 KB
/
InstalledGame.cs
File metadata and controls
48 lines (39 loc) · 1.14 KB
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
45
46
47
48
using System;
using System.Collections.Generic;
using System.Text;
namespace StateAndCommand
{
class InstalledGame : GameState
{
public InstalledGame(GameState state) : this(state.Game) {}
public InstalledGame(Game game)
{
this._game = game;
Initialize();
}
public override void BuyGame()
{
Console.WriteLine("You already own {0}.", _game.Name);
}
public override void DeleteGame()
{
Console.WriteLine("You uninstalled {0}! It can be reinstalled.", _game.Name);
_game.State = new BoughtGame(this);
}
public override void InstallGame()
{
Console.WriteLine("{0} is already installed.", _game.Name);
}
public override void StartGame()
{
Console.WriteLine("Starting {0}...", _game.Name);
_game.State = new StartedGame(this);
}
private void Initialize()
{
_isOwned = true;
_isInstalled = true;
_isPlaying = false;
}
}
}