Пример #1
0
        public GhostBuilder WithScatterTarget(CellLocation scatterTarget)
        {
            _scatterTarget = scatterTarget;

            _scatterStrategy = new DirectToStrategy(new DirectToGhostScatterTarget(_scatterTarget));

            return(this);
        }
Пример #2
0
 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)
 {
 }
Пример #3
0
 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;
 }
Пример #4
0
 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;
 }
Пример #5
0
 private Ghost WithNewCurrentStrategyAndDirection(IGhostStrategy newCurrentStrategy, Direction newDirection)
 => new Ghost(Name, Home, Location, newDirection, ScatterTarget, ChaseStrategy, newCurrentStrategy, Status, NumberOfCoinsRequiredToExitHouse);
Пример #6
0
 private Ghost WithNewStatusAndStrategy(GhostStatus newGhostStatus, IGhostStrategy newCurrentStrategy)
 => new Ghost(Name, Home, Location, Direction, ScatterTarget, ChaseStrategy, newCurrentStrategy, newGhostStatus, NumberOfCoinsRequiredToExitHouse);
Пример #7
0
        public GhostBuilder WithFrightenedStrategy(IGhostStrategy ghostStrategy)
        {
            _frightenedStrategy = ghostStrategy;

            return(this);
        }
Пример #8
0
        public GhostBuilder WithScatterStrategy(IGhostStrategy ghostStrategy)
        {
            _scatterStrategy = ghostStrategy;

            return(this);
        }
Пример #9
0
        public GhostBuilder WithChaseStrategy(IGhostStrategy ghostStrategy)
        {
            _chaseStrategy = ghostStrategy;

            return(this);
        }
Пример #10
0
 public Ghost(string name, CellLocation location, Direction direction, CellLocation scatterTarget, IGhostStrategy strategy)
     : this(name, location, location, direction, scatterTarget, strategy, strategy, false)
 {
 }
Пример #11
0
 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)
 {
 }
Пример #12
0
 private Ghost WithNewEdibleAndDirectionAndStrategy(bool isEdible, Direction newDirection, IGhostStrategy newCurrentStrategy)
 => new Ghost(Name, Home, Location, newDirection, ScatterTarget, ChaseStrategy, newCurrentStrategy, isEdible, NumberOfCoinsRequiredToExitHouse);
Пример #13
0
 private Ghost WithNewEdibleAndDirectionAndStrategy(GhostStatus newGhostStatus, Direction newDirection, IGhostStrategy newCurrentStrategy)
 => new Ghost(Name, Home, Location, newDirection, ChaseStrategy, ScatterStrategy, FrightenedStrategy, newCurrentStrategy, newGhostStatus, NumberOfCoinsRequiredToExitHouse);