Beispiel #1
0
 /*public AccelerationGameModel(IAccelerationDataAccess dataAccess)
  * {
  *  m_dataAccess = dataAccess;
  *
  * }
  */
 public AccelerationGameModel(Pair panelSize, Pair motorDimension, Pair petrolDimension)
 {
     m_dataAccess                = new AccelerationFileDataAccess();
     m_panelSize                 = panelSize;
     m_motorDimension            = motorDimension;
     m_petrolDimension           = petrolDimension;
     m_timer                     = new Timer();
     m_timerOfMoving             = new Timer();
     m_ticker                    = new Timer();
     m_accelerationTime          = new Timer();
     m_ticker.Tick              += On_SecTicking;
     m_timer.Tick               += On_NewPetrol;
     m_accelerationTime.Tick    += On_PetrolMoving;
     m_ticker.Tick              += On_DecreaseFuel;
     m_ticker.Interval           = 1000;
     m_timer.Interval            = 3000;
     m_timerOfMoving.Interval    = 1000;
     m_accelerationTime.Interval = 100;
     stepQuantity                = 8;
     m_loading                   = false;
 }
Beispiel #2
0
        public AccelerationGameModel(IAccelerationDataAccess dataAccess, Pair panelSize, Pair motorDimension, Pair petrolDimension)
        {
            m_dataAccess                = dataAccess;
            m_panelSize                 = panelSize;
            m_motorDimension            = motorDimension;
            m_petrolDimension           = petrolDimension;
            m_timer                     = new DispatcherTimer();
            m_timerOfMoving             = new DispatcherTimer();
            m_ticker                    = new DispatcherTimer();
            m_accelerationTime          = new DispatcherTimer();
            m_ticker.Tick              += On_SecTicking;
            m_timer.Tick               += On_NewPetrol;
            m_accelerationTime.Tick    += On_PetrolMoving;
            m_ticker.Tick              += On_DecreaseFuel;
            m_ticker.Interval           = TimeSpan.FromSeconds(1);
            m_timer.Interval            = TimeSpan.FromSeconds(3);
            m_timerOfMoving.Interval    = TimeSpan.FromSeconds(1);
            m_accelerationTime.Interval = TimeSpan.FromMilliseconds(100);
            Pair coordinates = new Pair(m_panelSize.m_x - m_motorDimension.m_x, m_panelSize.m_y / 2 - m_motorDimension.m_y / 2);

            m_motorCycle = new MotorCycleObject(coordinates, m_motorDimension);
            stepQuantity = 10;
            m_loading    = false;
        }