public PopBalloonsCommand(IBalloonsFactory balloonsFactory, IGameField gameField, int activeRow, int activeCol) { this.balloonsFactory = balloonsFactory; this.gameField = gameField; this.activeRow = activeRow; this.activeCol = activeCol; this.Name = "pop"; }
public void Setup() { this.renderer = new ConsoleRenderer(); this.field = new GameField(2, 2); this.fieldMemoryManager = new FieldMemoryManager(); this.balloonsFactory = new BalloonsFactory(); this.field[0, 0] = new BalloonOne(); this.field[0, 1] = new BalloonTwo(); this.field[1, 0] = new BalloonThree(); this.field[1, 1] = new BalloonFour(); }
public ICommand ProcessCommand( string commandString, IRenderer renderer, IGameField field, IFieldMemoryManager fieldMemoryManager, IBalloonsFactory balloonsFactory) { var commandParts = this.SplitCommandString(commandString); string commandName = commandParts[0]; int rowPosition = -1; int colPosition = -1; if (commandParts.Length == 3) { bool rowAndColumnPopulated = !(string.IsNullOrWhiteSpace(commandParts[1]) && string.IsNullOrWhiteSpace(commandParts[2])); bool rowAsInteger = int.TryParse(commandParts[1], out rowPosition); bool columnAsInteger = int.TryParse(commandParts[2], out colPosition); if (rowAndColumnPopulated && rowAsInteger && columnAsInteger) { rowPosition--; colPosition--; } else { rowPosition = InvalidRowAndColumnPosition; colPosition = InvalidRowAndColumnPosition; } } switch (commandName) { case "pop": { return new PopBalloonsCommand(balloonsFactory, field, rowPosition, colPosition); } case "top": { return new TopScoresCommand(renderer); } case "save": { return new SaveCommand(fieldMemoryManager, field); } case "restore": { return new RestoreCommand(fieldMemoryManager, field); } case "help": { return new HelpCommand(renderer); } case "exit": { return new ExitCommand(renderer); } default: { throw new InvalidOperationException("Invalid command request!"); } } }
public Filler(IBalloonsFactory balloonsFactory) { this.balloonsFactory = balloonsFactory; }
public void Setup() { this.renderer = new ConsoleRenderer(); this.field = new GameField(5, 5); this.fieldMemoryManager = new FieldMemoryManager(); this.balloonsFactory = new BalloonsFactory(); }
public BalloonsGameEngine BalloonsFactory(IBalloonsFactory balloonsFactory) { this.engineContext.BalloonsFactory = balloonsFactory; return this; }