-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserIO.cs
79 lines (75 loc) · 2.68 KB
/
UserIO.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGame
{
internal class UserIO
{
public static string GetPlayerName()
{
Console.WriteLine("Please Enter Your Desired Player Name: ");
return Console.ReadLine();
}
public static void Continue()
{
Console.Write("Press Enter to Continue...");
Console.ReadKey();
}
public static string GetUserReplayInput()
{
Console.WriteLine("Would you like to play again? \r\n" +
"Enter an x to exit or any other character to continue: ");
return Console.ReadLine().ToString();
}
public static void GreetPlayer(string playerName)
{
Console.WriteLine($"Well hello, and welcome to your doom...{playerName} \r\n" +
$"*evil laugh* \r\n" +
$"There is no escape and you will not be able to leave until death or prompted to do so otherwise. \r\n" +
$"Happy Doom!");
}
public static void OfferPath(List<int> paths)
{
Console.Write($"Choose wisely, there are two paths in front of you. Enter numerical {paths[0]} or numerical {paths[1]}: ");
}
public static int GetPlayerChoice(List<int> paths)
{
while (true)
{
string playerChoice = Console.ReadLine();
if (playerChoice == paths[0].ToString() || playerChoice == paths[1].ToString())
{
return Convert.ToInt32(playerChoice);
}
else
{
Console.WriteLine("Please enter a valid path from the two options provided: ");
}
}
}
public static void DisplayPathStory(string path)
{
Continue();
Console.Clear();
Console.WriteLine(path);
}
public static void DisplaySuccessMessage(Player player)
{
Continue();
Console.Clear();
Console.WriteLine($"Congratulations!\r\n" +
$"You won this round, defeating the lizzard!\r\n" +
$"Your stats are...\r\n" +
$"Health: {player.GetHealth()}\r\n" +
$"Attack Power: {player.GetAttackPower()}\r\n");
}
public static void DisplayPlayerDiedMessage()
{
Continue();
Console.Clear();
Console.WriteLine("Oh dear...You have tragically been defeated by a lowly lizard lifeform...Better luck next time! FOOL!");
}
}
}