Пример #1
0
 public SnowGameEngine
     (IGameContext gameContext, IPainter painter, IGameEventFactory eventFactory)
     : base(gameContext, painter, eventFactory)
 {
     _gameSpeed  = 80;
     _slowFactor = 0;
 }
Пример #2
0
        public SnakeObject(ICellFactory cellFactory, IGameEventFactory eventFactory, IConfigurationDataProvider dataProvider)
            : base(cellFactory, eventFactory)
        {
            _body   = new Queue <ICell>();
            _points = new Info("Points", 400, ConsoleColor.Magenta, 0, true);
            _info.Add(_points);
            _initialLifes           = int.Parse(dataProvider.Get("lifes"));
            Lifes                   = _initialLifes;
            _pointsToAdditionalLife = int.Parse(dataProvider.Get("pointsToAdditionalLife"));
            InitialLength           = int.Parse(dataProvider.Get("initialSnakeLength"));
            MaxLength               = int.Parse(dataProvider.Get("maxSnakeLength"));
            _timeToBomb             = int.Parse(dataProvider.Get("timeToBomb"));
            _bombRange              = int.Parse(dataProvider.Get("bombRange"));
            CurrentDirection        = Direction.Down;
            _stopwatch              = new Stopwatch();
            _stopwatch.Start();
            _bombCount = 0;

            _immortal = false;
            _immortalMoveStopwatch = new Stopwatch();
            _immortalMovePeriod    = int.Parse(dataProvider.Get("immortalMovePeriod"));

            _lifes = new Info("Lifes", 100, ConsoleColor.Green, Lifes, true);
            _info.Add(_lifes);
            _remainingFoods = new Info("Remaining foods", 500, ConsoleColor.Blue, MaxLength - Length, true);
            _info.Add(_remainingFoods);
            _timeToGetTimeBonus       = int.Parse(dataProvider.Get("timeGetTimeBonus"));
            _remainingTimeToTimeBonus = new Info("Time to get a timebonus", 700, ConsoleColor.Cyan, _timeToGetTimeBonus, false);
            _info.Add(_remainingTimeToTimeBonus);
            _timeToGetBomb = new Info("Time to get a bomb", 800, ConsoleColor.DarkMagenta, _timeToBomb, false);
            _info.Add(_timeToGetBomb);
            _bomb = new Info("Bombs", 900, ConsoleColor.DarkRed, _bombCount, true);
            _info.Add(_bomb);
        }
Пример #3
0
 public GameEngine(IGameContext gameContext, IPainter painter, IGameEventFactory eventFactory)
 {
     _gameContext  = gameContext;
     Painter       = painter;
     _eventFactory = eventFactory;
     CurrentEvent  = _eventFactory.Create("Start", _gameContext);
 }
Пример #4
0
 public SnowInTheAirObject(ICellFactory cellFactory, IGameEventFactory eventFactory)
     : base(cellFactory, eventFactory)
 {
     _random          = new Random();
     _direction       = Direction.Down;
     _intensity       = 1;
     _currentPosition = 0;
 }
Пример #5
0
 public GameObject(ICellFactory cellFactory, IGameEventFactory eventFactory)
 {
     _body         = new HashSet <ICell>();
     _info         = new List <IInfo>();
     _cellFactory  = cellFactory;
     _eventFactory = eventFactory;
     BePainted     = true;
 }
Пример #6
0
 public BonusObject(ICellFactory cellFactory, IGameEventFactory eventFactory, IConfigurationDataProvider dataProvider)
     : base(cellFactory, eventFactory)
 {
     _random           = new Random();
     _stopwatch        = new Stopwatch();
     _remainingTime    = int.Parse(dataProvider.Get("remainingTime"));
     _bonusPossibility = int.Parse(dataProvider.Get("bonusPossibility"));
 }
Пример #7
0
 public SnowOnTheGroundObject(ICellFactory cellFactory, IGameEventFactory eventFactory)
     : base(cellFactory, eventFactory)
 {
     _width            = 3;
     _meltingIntensity = 3;
     _random           = new Random();
     _currentPosition  = 0;
     //_bodyForDrawing = new List<ICell>();
     BePainted = false;
 }
Пример #8
0
 public FoodObject(ICellFactory cellFactory, IGameEventFactory eventFactory, IConfigurationDataProvider dataProvider)
     : base(cellFactory, eventFactory)
 {
     _random             = new Random();
     _stopwatch          = new Stopwatch();
     _timeFoodBeEaten    = int.Parse(dataProvider.Get("timeFoodBeEaten"));
     _remainingTimeToEat = new Info("Time to get a food", 600, ConsoleColor.DarkGreen, _timeFoodBeEaten, false);
     _info.Add(_remainingTimeToEat);
     _timeToBomb       = int.Parse(dataProvider.Get("timeToBomb"));
     _timeGetTimeBonus = int.Parse(dataProvider.Get("timeGetTimeBonus"));
 }
Пример #9
0
 public SnakeGameEngine
     (IGameContext gameContext,
     IPainter painter,
     IGameEventFactory gameEventFactory,
     FoodObject additionalFood)
     : base(gameContext, painter, gameEventFactory)
 {
     _gameSpeed      = 80;
     _slowFactor     = 0;
     CurrentEvent    = _eventFactory.Create("Start", _gameContext);
     _additionalFood = additionalFood;
 }
Пример #10
0
 public WallObject(ICellFactory cellFactory, IGameEventFactory eventFactory, IConfigurationDataProvider dataProvider)
     : base(cellFactory, eventFactory)
 {
     _random           = new Random();
     Level             = 1;
     MaxLevel          = int.Parse(dataProvider.Get("maxLevel"));
     WallSpreadDencity = int.Parse(dataProvider.Get("wallSpreadDencity"));
     MinWallLength     = int.Parse(dataProvider.Get("minWallLength"));
     MaxWallLength     = int.Parse(dataProvider.Get("maxWallLength"));
     _level            = new Info("Level", 200, ConsoleColor.DarkGray, Level, true);
     _info.Add(_level);
 }
Пример #11
0
 public GroundObject(ICellFactory cellFactory, IGameEventFactory eventFactory)
     : base(cellFactory, eventFactory)
 {
     _random          = new Random();
     _currentPosition = 0;
 }