public Controller() { this.gangNeighbourhood = new GangNeighbourhood(); this.gunRepository = new Queue <IGun>(); this.players = new List <IPlayer>(); this.mainPlayer = new MainPlayer(); }
public Controller() { this.player = new MainPlayer(); gunRepository = new GunRepository(); players = new List <IPlayer>(); neighbourhood = new GangNeighbourhood(); }
public Controller() { this.PlayersList = new List <IPlayer>(); this.gunRepository = new GunRepository(); this.mainPlayer = new MainPlayer(); this.gangNeighbourhood = new GangNeighbourhood(); }
public Controller() { this.mainPlayer = new MainPlayer(); this.civilPlayers = new List <IPlayer>(); this.guns = new List <IGun>(); this.gangNeighbourhood = new GangNeighbourhood(); }
public Controller() { this.players = new List <IPlayer>(); this.players.Add(new MainPlayer()); this.gunRepository = new GunRepository(); this.gangNeighbourhood = new GangNeighbourhood(); }
public string Fight() { StringBuilder sb = new StringBuilder(); INeighbourhood neighbourhood = new GangNeighbourhood(); int playersCountBeforeTheFight = this.players.Count; int playersHealthBefore = this.players.Sum(p => p.LifePoints); neighbourhood.Action(this.mainPlayer, this.players); int playersHealthAfter = this.players.Sum(p => p.LifePoints); if (this.mainPlayer.LifePoints == 100 && this.players.Count == playersCountBeforeTheFight && playersHealthBefore == playersHealthAfter) { return("Everything is okay!"); } sb.AppendLine("A fight happened:"); sb.AppendLine($"Tommy live points: {this.mainPlayer.LifePoints}!"); sb.AppendLine($"Tommy has killed: {playersCountBeforeTheFight - this.players.Count} players!"); sb.AppendLine($"Left Civil Players: {this.players.Count}!"); return(sb.ToString().TrimEnd()); }
public string Fight() { var oldPlayer = player; var oldCivils = civils; // Fight var gang = new GangNeighbourhood(); gang.Action(player, civils as ICollection <IPlayer>); // Nothing happend if (oldPlayer == player && oldCivils == civils) { return("Everything is okay!"); } // Result StringBuilder sb = new StringBuilder(); sb.Append("A fight happened:" + Environment.NewLine); sb.Append($"Tommy live points: {player.LifePoints}!" + Environment.NewLine); sb.Append($"Tommy has killed: {oldCivils.Count - civils.Count} players!" + Environment.NewLine); sb.Append($"Left Civil Players: {civils.Count}!" + Environment.NewLine); return(sb.ToString()); }
public Controller() { this.gunRepository = new GunRepository(); this.playerRepository = new PlayerRepository(); this.gangNeighbourhood = new GangNeighbourhood(); }
public Controller() { mainPlayer = new MainPlayer(); this.gunRepository = new GunRepository(); this.civilPlayers = new List <Player>(); this.gangNeighbourhood = new GangNeighbourhood(); }
public Controller() { hood = new GangNeighbourhood(); civils = new List <IPlayer>(); guns = new List <IGun>(); mainPlayer = new MainPlayer(); }
public string Fight() { MainPlayer mainPlayer = new MainPlayer(); GangNeighbourhood gangNeighbourhood = new GangNeighbourhood(); gangNeighbourhood.Action(mainPlayer, civilPlayers); StringBuilder sb = new StringBuilder(); if (civilPlayers.Any(p => p.IsAlive == true) && mainPlayer.LifePoints == 100) { sb.AppendLine("Everything is okay!"); } else { sb.AppendLine("A fight happened:"); sb.AppendLine($"Tommy live points: {mainPlayer.LifePoints}!"); sb.AppendLine($"Tommy has killed: {civilPlayers.Where(p => p.IsAlive == false).Count()} players!"); sb.AppendLine($"Left Civil Players: {civilPlayers.Where(p => p.IsAlive == true).Count()}!"); } return(sb.ToString().TrimEnd()); }
public Controller() { mainPlayer = new MainPlayer(); _gunFactory = new GunFactory(); guns = new Queue <IGun>(); civilPlayers = new List <IPlayer>(); _neighbourhood = new GangNeighbourhood(); }
public Controller() { this.mainPlayer = new MainPlayer(); this.gunsCollection = new GunRepository(); this.players = new List <IPlayer>(); this.players.Add(mainPlayer); this.neighbourhood = new GangNeighbourhood(); }
public Controller() { mainPlayer = new MainPlayer(); civilPlayers = new List <IPlayer>(); gunRepository = new GunRepository(); deadPlayers = new List <IPlayer>(); neighbourhood = new GangNeighbourhood(); }
static void Main(string[] args) { IPlayer mainPlayer = new MainPlayer(); INeighbourhood neighbourhood = new GangNeighbourhood(); IController controller = new Controller(mainPlayer, neighbourhood); IEngine engine = new Engine(controller); engine.Run(); }
//----------- Constructors ------------ //GunRepository<IGun> gunRepository, GunFactory gunFactory, INeighbourhood neighbourhood public Controller() { this.gunRepository = new GunRepository <IGun>(); this.gunFactory = new GunFactory(); this.neighbourhood = new GangNeighbourhood(); this.mainPlayer = new MainPlayer(); this.players = new Dictionary <string, IPlayer>(); this.gunQueue = new Queue <IGun>(); }
public Engine() { this.reader = new Reader(); this.writer = new Writer(); this.gunRepository = new GunRepository <IGun>(); this.gunFactory = new GunFactory(); this.neighbourhood = new GangNeighbourhood(); //gunRepository, gunFactory, neighbourhood this.controller = new Controller(); }
public static void Main() { IReader reader = new Reader(); IWriter writer = new Writer(); IPlayer mainPlayer = new MainPlayer(); INeighbourhood gangNeighbourhood = new GangNeighbourhood(); IGunFactory gunFactory = new GunFactory(); IController controller = new Controller( mainPlayer, gangNeighbourhood, gunFactory); IEngine engine = new Engine( reader, writer, controller); engine.Run(); }
public string Fight() { GangNeighbourhood fightScene = new GangNeighbourhood(); fightScene.Action(mainPlayer, players); if (mainPlayer.LifePoints == 100) { bool isOk = true; foreach (var civilian in players) { if (civilian.LifePoints < 50) { isOk = false; break; } } if (isOk) { return("Everything is okay!"); } } int dead = 0; int alive = 0; foreach (var civilian in players) { if (civilian.IsAlive) { alive++; } else { dead++; } } return($"A fight happened:" + Environment.NewLine + $"Tommy live points: {mainPlayer.LifePoints}!" + Environment.NewLine + $"Tommy has killed: {dead} players!" + Environment.NewLine + $"Left Civil Players: {alive}!"); }
public static void Main() { var consoleReader = new Reader(); var consoleWriter = new Writer(); var mainPlayer = new MainPlayer(); var gangNeighbourhood = new GangNeighbourhood(); var gunFactory = new GunFactory(); var civilPlayerFactory = new CivilPlayerFactory(); var controller = new Controller( mainPlayer, gangNeighbourhood, gunFactory, civilPlayerFactory); var engine = new Engine( consoleReader, consoleWriter, controller); engine.Run(); }