Beispiel #1
0
        public void ApplyCheckpointStateData(long seqNum, long timeStamp, string stateHash, string serializedData)
        {
            logger.Debug($"ApplyStateData() Seq#: seqNum ApianTime: {timeStamp}");

            UpdateFrameTime(timeStamp);
            CoreData = BeamCoreState.FromApianSerialized(seqNum, timeStamp, stateHash, serializedData);
            OnNewCoreState(); // send NewCoreStateEvt

            foreach (BeamPlayer p in CoreData.Players.Values)
            {
                if (p.PeerId == LocalPeerId)
                {
                    LocalPlayer = p;
                }
                PlayerJoinedEvt.Invoke(this, new PlayerJoinedArgs(CurrentGameId, p));
            }

            foreach (IBike ib in CoreData.Bikes.Values)
            {
                NewBikeEvt?.Invoke(this, ib);
            }


            foreach (BeamPlace p in CoreData.activePlaces.Values)
            {
                CoreData.AnnounceNewPlace(p);  //
            }
        }
Beispiel #2
0
        public bool _AddBike(IBike ib)
        {
            logger.Verbose($"_AddBike(): {ib.bikeId} at ({ib.basePosition.x}, {ib.basePosition.y})");

            if (CoreData.GetBaseBike(ib.bikeId) != null)
            {
                return(false);
            }

            CoreData.Bikes[ib.bikeId] = ib;

            NewBikeEvt?.Invoke(this, ib);

            return(true);
        }