Changed a lot of Actions.cs and a few other things to be more easily
extendable.
This commit is contained in:
42
Player.cs
42
Player.cs
@@ -2,19 +2,43 @@ public class Player : Character
|
||||
{
|
||||
public Player()
|
||||
{
|
||||
maxHP = 10;
|
||||
currentHP = maxHP;
|
||||
name = GetName();
|
||||
CharacterEnabledActions.AddRange("Do Nothing", "Attack", "Items");
|
||||
|
||||
maxHP = 25;
|
||||
currentHP = maxHP;
|
||||
dead = false;
|
||||
CharacterEnabledActions.AddRange("Punch", "Health Potion", "Items", "Do Nothing");
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
string? input;
|
||||
Console.Write("Enter your player's name: ");
|
||||
input = Console.ReadLine();
|
||||
return input;
|
||||
string input = null;
|
||||
if (GameState.Instance.herosAIControl == false)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
input = ColoredConsole.Prompt("Enter your name");
|
||||
if (input.Length < 1)
|
||||
{
|
||||
ColoredConsole.WriteLine("Sorry, that isn't a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return input;
|
||||
}
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
ColoredConsole.WriteLine("Sorry, that isn't a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "The True Programmer";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user