public GhostBuilder WithScatterTarget(CellLocation scatterTarget) { _scatterTarget = scatterTarget; _scatterStrategy = new DirectToStrategy(new DirectToGhostScatterTarget(_scatterTarget)); return(this); }
public Ghost(string name, CellLocation location, Direction direction, IGhostStrategy chaseStrategy, IGhostStrategy scatterStrategy, IGhostStrategy frightenedStrategy, int numberOfCoinsRequiredToExitHouse = 0) : this(name, location, location, direction, chaseStrategy, scatterStrategy, frightenedStrategy, chaseStrategy, GhostStatus.Alive, numberOfCoinsRequiredToExitHouse) { }
private Ghost(string name, CellLocation homeLocation, CellLocation currentLocation, Direction direction, CellLocation scatterTarget, IGhostStrategy strategy, IGhostStrategy currentStrategy, bool edible) { Name = name; Home = homeLocation; Location = currentLocation; Direction = direction; Strategy = strategy; CurrentStrategy = currentStrategy; ScatterTarget = scatterTarget; Edible = edible; }
private Ghost(string name, CellLocation homeLocation, CellLocation currentLocation, Direction direction, CellLocation scatterTarget, IGhostStrategy chaseStrategy, IGhostStrategy currentStrategy, GhostStatus ghostStatus, int numberOfCoinsRequiredToExitHouse) { Name = name; Home = homeLocation; Location = currentLocation; Direction = direction; ChaseStrategy = chaseStrategy; CurrentStrategy = currentStrategy; ScatterTarget = scatterTarget; Status = ghostStatus; NumberOfCoinsRequiredToExitHouse = numberOfCoinsRequiredToExitHouse; }
private Ghost WithNewCurrentStrategyAndDirection(IGhostStrategy newCurrentStrategy, Direction newDirection) => new Ghost(Name, Home, Location, newDirection, ScatterTarget, ChaseStrategy, newCurrentStrategy, Status, NumberOfCoinsRequiredToExitHouse);
private Ghost WithNewStatusAndStrategy(GhostStatus newGhostStatus, IGhostStrategy newCurrentStrategy) => new Ghost(Name, Home, Location, Direction, ScatterTarget, ChaseStrategy, newCurrentStrategy, newGhostStatus, NumberOfCoinsRequiredToExitHouse);
public GhostBuilder WithFrightenedStrategy(IGhostStrategy ghostStrategy) { _frightenedStrategy = ghostStrategy; return(this); }
public GhostBuilder WithScatterStrategy(IGhostStrategy ghostStrategy) { _scatterStrategy = ghostStrategy; return(this); }
public GhostBuilder WithChaseStrategy(IGhostStrategy ghostStrategy) { _chaseStrategy = ghostStrategy; return(this); }
public Ghost(string name, CellLocation location, Direction direction, CellLocation scatterTarget, IGhostStrategy strategy) : this(name, location, location, direction, scatterTarget, strategy, strategy, false) { }
public Ghost(string name, CellLocation location, Direction direction, CellLocation scatterTarget, IGhostStrategy chaseStrategy, int numberOfCoinsRequiredToExitHouse = 0) : this(name, location, location, direction, scatterTarget, chaseStrategy, chaseStrategy, false, numberOfCoinsRequiredToExitHouse) { }
private Ghost WithNewEdibleAndDirectionAndStrategy(bool isEdible, Direction newDirection, IGhostStrategy newCurrentStrategy) => new Ghost(Name, Home, Location, newDirection, ScatterTarget, ChaseStrategy, newCurrentStrategy, isEdible, NumberOfCoinsRequiredToExitHouse);
private Ghost WithNewEdibleAndDirectionAndStrategy(GhostStatus newGhostStatus, Direction newDirection, IGhostStrategy newCurrentStrategy) => new Ghost(Name, Home, Location, newDirection, ChaseStrategy, ScatterStrategy, FrightenedStrategy, newCurrentStrategy, newGhostStatus, NumberOfCoinsRequiredToExitHouse);