diff --git a/PeopleVille/Program.cs b/PeopleVille/Program.cs index 82e2698..573b521 100644 --- a/PeopleVille/Program.cs +++ b/PeopleVille/Program.cs @@ -1,4 +1,7 @@ using PeopleVille; +using PeopleVille.Equipment; +using PeopleVille.Persons; +using PeopleVille.WorldBuilder; var gameManager = new GameManager(); @@ -6,3 +9,18 @@ await gameManager.StartClock(); // See https://aka.ms/new-console-template for more information Console.WriteLine("Hello, World!"); + + +/* burde i teorien virke? +var testCitizen = new AdultCitizen { Name = "", Health = 100 }; +testCitizen.Inventory.Add(new Gun { Name = "Glock", Damage = 50 }); */ + +/* builder? +var builder = new CitizenBuilder(); + +builder + .CreateAdult("Lars", 100).WithGun("Glock", 20) + .CreateAdult("Thomas", 100).WithGun("AK", 40).WithFood("Hvid Monster", 0) + .CreateChild("Troels", 60).WithFood("Apple", 10); + +var borgere = builder.Build(); */ \ No newline at end of file diff --git a/PeopleVille/WorldBuilder/WorldBuilder.cs b/PeopleVille/WorldBuilder/WorldBuilder.cs index 1cd86f2..9ed002b 100644 --- a/PeopleVille/WorldBuilder/WorldBuilder.cs +++ b/PeopleVille/WorldBuilder/WorldBuilder.cs @@ -1,10 +1,46 @@ -using System; +using PeopleVille.Equipment; +using PeopleVille.Persons; +using System; using System.Collections.Generic; using System.Text; +using static PeopleVille.WorldBuilder.WorldInterfaces; namespace PeopleVille.WorldBuilder { - internal class WorldBuilder + public class CitizenBuilder : ICitizenBuilder { + Person person; + List Citizens = new List(); + + public ICitizenBuilder CreateAdult(string name, int health) + { + person = new AdultCitizen { Name = name, Health = health, Inventory = new List() }; + Citizens.Add(person); + return this; + } + + public ICitizenBuilder CreateChild(string name, int health) + { + person = new ChildCitizen { Name = name, Health = health, Inventory = new List() }; + Citizens.Add(person); + return this; + } + + public ICitizenBuilder WithGun(string name, int damage) + { + person.Inventory.Add(new Gun { Name = name, Damage = damage }); + return this; + } + + public ICitizenBuilder WithFood(string name, int healthPoints) + { + person.Inventory.Add(new Food { Name = name, HealthPoints = healthPoints }); + return this; + } + + public Person Build() + { + return person; + } } } diff --git a/PeopleVille/WorldBuilder/WorldInterfaces.cs b/PeopleVille/WorldBuilder/WorldInterfaces.cs index 90e53df..74fbe45 100644 --- a/PeopleVille/WorldBuilder/WorldInterfaces.cs +++ b/PeopleVille/WorldBuilder/WorldInterfaces.cs @@ -1,10 +1,26 @@ -using System; -using System.Collections.Generic; -using System.Text; +using PeopleVille.Persons; namespace PeopleVille.WorldBuilder { - internal class WorldInterfaces + public class WorldInterfaces { + public interface IWorldBuilder + { + + } + + public interface ITownBuilder + { + + } + + public interface ICitizenBuilder + { + ICitizenBuilder CreateAdult(string name, int health); + ICitizenBuilder CreateChild(string name, int health); + ICitizenBuilder WithGun(string name, int damage); + ICitizenBuilder WithFood(string name, int healthPoints); + Person Build(); + } } }