more detail in console text, worked towards dictionary instead of hard-coded options.

This commit is contained in:
Pecha 2020-09-07 17:16:56 +10:00
parent 7812e7cc2b
commit 570560a202
8 changed files with 29 additions and 11 deletions

View File

@ -2,18 +2,28 @@ using System;
namespace creachopedia { namespace creachopedia {
class Creacher { class Creacher {
public string name; public string name {get; set;}
public int kingdom; // public int kingdom;
public string description; // public string description;
public int footsies; private int _footsies;
public int footsies {get { return this._footsies; } set { Console.WriteLine("What do you think you're doing?! 0uo Leave those footsies alone!!!"); }}
public string type = "simple creacher";
public Creacher(string name, int footsyCount = 4) { public Creacher(string name, int footsyCount = 4) {
this.name = name; this.name = name;
this.footsies = footsyCount; this._footsies = footsyCount;
} }
public void Introduce() { public void Introduce() {
Console.WriteLine($"Hello, my name is... {this.name}. I am a {this.GetType()}, and I have {this.footsies} footsies."); Console.WriteLine($"Hello, my name is... {this.name}. I am a {this.type}, and I have {this.footsies} footsies.");
}
public void Step(){
if(this.footsies == 0){
Console.WriteLine("I cannot stip or step! I have 0 footsies!!!!");
Console.WriteLine("Silly creacher...");
} else {
Console.WriteLine($"The {this.name} steps, and rather well I might add.");
}
} }
} }
} }

View File

@ -1,22 +1,22 @@
namespace creachopedia { namespace creachopedia {
class GroundCreacher:Creacher { class GroundCreacher:Creacher {
public GroundCreacher(string name, int footsyCount):base(name, footsyCount){ public GroundCreacher(string name, int footsyCount):base(name, footsyCount){
this.type = "creacher of the land";
} }
} }
class AirCreacher:Creacher { class AirCreacher:Creacher {
public AirCreacher(string name, int footsyCount):base(name, footsyCount){ public AirCreacher(string name, int footsyCount):base(name, footsyCount){
this.type = "creacher of the sky";
} }
} }
class WaterCreacher:Creacher{ class WaterCreacher:Creacher{
public WaterCreacher(string name, int footsyCount):base(name, footsyCount){ public WaterCreacher(string name, int footsyCount):base(name, footsyCount){
this.type = "creacher of the water";
} }
} }
class UndergroundCreacher:Creacher { class UndergroundCreacher:Creacher {
public UndergroundCreacher(string name, int footsyCount):base(name, footsyCount){ public UndergroundCreacher(string name, int footsyCount):base(name, footsyCount){
this.type = "creacher that lives underground";
} }
} }
} }

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading;
namespace creachopedia { namespace creachopedia {
@ -12,10 +13,12 @@ namespace creachopedia {
creacherdict.Add("stingray", new WaterCreacher("stingray", 0)); creacherdict.Add("stingray", new WaterCreacher("stingray", 0));
while (true) { while (true) {
Console.WriteLine("Please input a creacher name 0u0"); Console.WriteLine("Please input a creacher name, or (q) to quit 0u0");
string userin = Console.ReadLine(); string userin = Console.ReadLine();
if (creacherdict.ContainsKey(userin)) { if (creacherdict.ContainsKey(userin)) {
creacherdict[userin].Introduce(); creacherdict[userin].Introduce();
creacherdict[userin].Step();
creacherdict[userin].footsies = 2;
} }
else if(userin == "q"){ else if(userin == "q"){
Console.WriteLine("Thank you for using the CreachoPedia!!!!"); Console.WriteLine("Thank you for using the CreachoPedia!!!!");
@ -27,6 +30,8 @@ namespace creachopedia {
else { else {
Console.WriteLine("I don't know what that is! What on boo Earth?!!?!?!?"); Console.WriteLine("I don't know what that is! What on boo Earth?!!?!?!?");
} }
Console.WriteLine("");
Thread.Sleep(1000);
} }

3
creachopedia.json Normal file
View File

@ -0,0 +1,3 @@
{
}