Exemple #1
0
        public void OnPlaceHitCmd(PlaceHitMsg msg)
        {
            // Apian has already checked the the place is claimed and the bike exists
            Vector2   pos         = BeamPlace.PlacePos(msg.xIdx, msg.zIdx);
            BeamPlace p           = CoreData.GetPlace(pos);
            BaseBike  hittingBike = CoreData.GetBaseBike(msg.bikeId);

            if (p != null && hittingBike != null)
            {
                hittingBike.UpdatePosFromCommand(msg.TimeStamp, FrameApianTime, p.GetPos(), msg.exitHead);
                logger.Info($"OnPlaceHitCmd{p?.GetPos().ToString()} Now: {FrameApianTime} Ts: {msg.TimeStamp} Bike: {hittingBike?.bikeId} Pos: {p?.GetPos().ToString()}");
                ApplyScoreUpdate(msg.scoreUpdates);
                PlaceHitEvt?.Invoke(this, new PlaceHitArgs(p, hittingBike));
            }
            else
            {
                logger.Info($"OnPlaceHitCmd{p?.GetPos().ToString()} Now: {FrameApianTime} Ts: {msg.TimeStamp} Bike: {hittingBike?.bikeId} Pos: {p?.GetPos().ToString()}");
            }
        }
Exemple #2
0
 protected void RemoveActivePlace(BeamPlace p)
 {
     if (p != null)
     {
         Logger.Verbose($"RemoveActivePlace({p.GetPos().ToString()}) Bike: {p.bike?.bikeId}");
         PlaceFreedEvt?.Invoke(this, p);
         freePlaces.Push(p); // add to free list
         activePlaces.Remove(p.PosHash);
         _reportedTimedOutPlaces.Remove(p.PosHash);
         p.bike = null; // this is the only reference it holds
     }
 }
Exemple #3
0
 public void OnPlaceTimeoutEvt(object sender, BeamPlace p)
 {
     logger.Verbose($"OnPlaceTimeoutEvt(): {p.GetPos().ToString()}");
     apian.SendPlaceRemovedObs(FrameApianTime, p.xIdx, p.zIdx);
 }