Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FixedStepTimer"/> class.
        /// </summary>
        /// <param name="clock">The clock.</param>
        public FixedStepTimer(IGameClock clock)
        {
            Speed  = 1.0;
            _clock = clock;

            StepSize            = new TimeSpan(166666);
            StepSizeTolerance   = new TimeSpan(2500);
            MaxNumberOfSteps    = 8;
            AccumulateTimeSteps = true;
            _maxStepSize        = new TimeSpan(StepSize.Ticks * MaxNumberOfSteps);
        }
Esempio n. 2
0
 public Game(IGameClock gameClock, IGameSettings settings)
 {
     _gameClock           = gameClock;
     _settings            = settings;
     PacMan               = settings.PacMan;
     _collectedCoins      = new List <CellLocation>();
     _collectedPowerPills = new List <CellLocation>();
     _ghosts              = settings.Ghosts.ToDictionary(x => x.Name, x => x);
     _gameStateMachine    = new GameStateMachine(this, settings, _gameNotifications);
     _gameState           = new GameState(settings);
 }
Esempio n. 3
0
        public Game(IGameClock gameClock, IGameSettings settings)
        {
            _gameClock        = gameClock;
            _settings         = settings;
            _gameStateMachine = new GameStateMachine(settings, _gameNotifications, this);
            var gameState = new GameState(settings);

            _gameState = gameState;
            _gameStateMachineInstance = _gameStateMachine.CreateInstanceLift(gameState);
            Walls          = _settings.Walls.Union(_settings.Doors).ToList().AsReadOnly();
            _fruitForLevel = new[] { new Fruit(_settings.Fruit, FruitType.Cherry) };
        }
Esempio n. 4
0
        public BlackjackApplication(IDealer dealer, IBlackjackConsole console, IGameClock clock)
        {
            this.dealer  = dealer ?? throw new ArgumentNullException(nameof(dealer));
            this.console = console ?? throw new ArgumentNullException(nameof(console));
            this.clock   = clock ?? throw new ArgumentNullException(nameof(clock));

            playingPlayers = new List <Player>();
            activePlayers  = new List <Player>();
            absentPlayers  = new List <Player>();

            bets = new Dictionary <Player, List <PlayerBet> >();
        }
Esempio n. 5
0
        public Game(IGameClock gameClock, IGameSettings settings)
        {
            _gameClock = gameClock;
            _settings  = settings;
            var actions = new Actions(settings, _gameNotifications);

            _gameStateMachine = new GameStateMachine(actions, settings, this);
            var gameState = new GameState(settings);

            _gameState = gameState;
            _gameStateMachineInstance = _gameStateMachine.CreateInstanceLift(gameState);
            WallsAndDoors             = _settings.Walls.Union(_settings.Doors).ToList().AsReadOnly();
            Walls            = _settings.Walls;
            _fruitForLevel   = new[] { new Fruit(_settings.Fruit, FruitType.Cherry) };
            GhostHouseMiddle = CalculateMiddleOfGhostHouse(settings.GhostHouse);
        }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VariableStepTimer"/> class.
 /// </summary>
 /// <param name="clock">The clock.</param>
 public VariableStepTimer(IGameClock clock)
 {
     Speed  = 1.0;
     _clock = clock;
 }
Esempio n. 7
0
 //--------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="VariableStepTimer"/> class.
 /// </summary>
 /// <param name="clock">The clock.</param>
 public VariableStepTimer(IGameClock clock)
 {
     Speed = 1.0;
       _clock = clock;
 }
Esempio n. 8
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="FixedStepTimer"/> class.
        /// </summary>
        /// <param name="clock">The clock.</param>
        public FixedStepTimer(IGameClock clock)
        {
            Speed = 1.0;
              _clock = clock;

              StepSize = new TimeSpan(166666);
              StepSizeTolerance = new TimeSpan(2500);
              MaxNumberOfSteps = 8;
              AccumulateTimeSteps = true;
              _maxStepSize = new TimeSpan(StepSize.Ticks * MaxNumberOfSteps);
        }