public void OnPlaceRemovedCmd(PlaceRemovedMsg msg) { BeamPlace p = CoreData.GetPlace(msg.xIdx, msg.zIdx); logger.Verbose($"OnPlaceRemovedCmd({msg.xIdx},{msg.zIdx}) {(p==null?"MISSING":"")} Now: {FrameApianTime} Ts: {msg.TimeStamp}"); CoreData.PostPlaceRemoval(p); }
public void OnPlaceHitObsEvt(object sender, PlaceReportArgs args) { logger.Verbose($"OnPlaceHitObsEvt(): Bike: {args.bike.bikeId} Place: {BeamPlace.PlacePos(args.xIdx, args.zIdx).ToString()}"); BeamPlace place = CoreData.GetPlace(args.xIdx, args.zIdx); ScoreEvent evType = place.bike.team == args.bike.team ? ScoreEvent.kHitFriendPlace : ScoreEvent.kHitEnemyPlace; apian.SendPlaceHitObs(FrameApianTime, args.bike, args.xIdx, args.zIdx, args.entryHead, args.exitHead, ComputeScoreUpdate(args.bike, evType, place)); }
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()}"); } }