Example #1
0
        private void _checkPosition(long apianTime)
        {
            if (baseTime == 0) // TODO: get rid of this one the changeover is complete
            {
                logger.Error($"_checkPosition() Bike: {bikeId} TimeAtPosition UNITITIALIZED!");
            }

            float secs = (apianTime - baseTime) * .001f;

            if (secs <= 0 || speed == 0) // nothing can have happened
            {
                return;
            }

            Vector2 upcomingPoint = UpcomingGridPoint(basePosition); // using the last logged position
            float   timeToPoint   = Vector2.Distance(basePosition, upcomingPoint) / speed;

            Vector2 newPos  = basePosition;
            Heading newHead = baseHeading;

            // Note that this assumes that secs < timeToCrossAGrid
            // TODO: should it handle longer times?
            if (secs >= timeToPoint)
            {
                //logger.Verbose($"_checkPosition() Bike: {bikeId} MsToPoint: {(long)(timeToPoint*1000)}");
                long timeAtPoint = baseTime + (long)(timeToPoint * 1000);
                newPos  = upcomingPoint;
                newHead = GameConstants.NewHeadForTurn(baseHeading, basePendingTurn);
                DoAtGridPoint(upcomingPoint, baseHeading, newHead, timeAtPoint);

                // pre-entively update the next grid position
                // There will be an observation reported arriving withte same data
                // but we're better off assuming it'll match and fixing it later than
                // waiting for it
                _updatePosition(newPos, newHead, timeAtPoint);
            }
        }
 public void OnReadyToPlay(object sender, EventArgs e)
 {
     logger.Error($"OnReadyToPlay() - doesn't work anymore");
     //logger.Info($"OnReadyToPlay()");
     //&&& backend.OnSwitchModeReq(BeamModeFactory.kPlay, null);
 }
Example #3
0
 public void ExitAbruptly(string message)
 {
     appl.frontend.DisplayMessage(MessageSeverity.Error, message);
     logger.Error(message);
     manager.Stop();
 }
Example #4
0
 public void OnReadyToPlay(object sender, EventArgs e)
 {
     logger.Error($"OnReadyToPlay() - doesn't work anymore");
     //startBtn.SetActive(true);
     //mainObj.core.OnSwitchModeReq(BeamModeFactory.kPlay, null);
 }