Example #1
0
        public ISnapshot GeneratePartialSnapshot(int seq,
                                                 EntityKey self,
                                                 Vector3 position,
                                                 Bin2DConfig config,
                                                 IBin2DManager bin,
                                                 List <IGameEntity> preEntitys)
        {
            _preEntitys.Clear();
            _seq = seq;
            _filter.Init(self, position);
            _snapshot = Snapshot.Allocate();

            foreach (var gameEntity in preEntitys)
            {
                DoInsert(gameEntity);
                _preEntitys.Add(gameEntity.EntityKey);
            }


            foreach (var bin2DState in bin.GetBin2Ds())
            {
                Rect rect = new Rect(position.x - bin2DState.VisibleRadius, position.z - bin2DState.VisibleRadius,
                                     bin2DState.VisibleRadius * 2, bin2DState.VisibleRadius * 2);
                bin2DState.Retrieve(position, rect, _doInsert);
            }


            return(_snapshot);
        }
        public ISnapshot GeneratePerPlayerSnapshot(int seq, EntityKey self, Vector3 position, Bin2DConfig config,
                                                   IBin2DManager bin, List <IGameEntity> preEntitys, bool isAccountStage,
                                                   bool isPrepareStage, SnapshotEntityInsert onInsert)
        {
            preEntityKeys.Clear();

            sendSnapshotFilter.Init(self, position);
            snapshot            = Snapshot.Allocate();
            forPre              = true;
            this.isPrepareStage = isPrepareStage;
            this.isAccountStage = isAccountStage;
            this.seq            = seq;
            this.onInsert       = onInsert;
            foreach (var gameEntity in preEntitys)
            {
                DoInsert(gameEntity);
                preEntityKeys.Add(gameEntity.EntityKey);
            }

            forPre = false;

            foreach (var bin2DState in bin.GetBin2Ds())
            {
                Rect rect = new Rect(position.x - bin2DState.VisibleRadius, position.z - bin2DState.VisibleRadius,
                                     bin2DState.VisibleRadius * 2, bin2DState.VisibleRadius * 2);
                bin2DState.Retrieve(position, rect, gameEntity => DoInsert(gameEntity));
            }

            return(snapshot);
        }
Example #3
0
        public ISnapshot GenerateCompensationSnapshot()
        {
            Snapshot snapshot = Snapshot.Allocate();

            EntityMapDeepCloner.Clone(snapshot.EntityMap, _gameContexts.CompensationEntityMap, _compensationFilter);
            return(snapshot);
        }
Example #4
0
        public ISnapshot GenerateSnapshot(EntityKey self, Vector3 position)
        {
            Snapshot snapshot = Snapshot.Allocate();

            EntityMapDeepCloner.Clone(snapshot.EntityMap, _gameContexts.EntityMap,
                                      new PreSendSnapshotFilter(self, position));
            return(snapshot);
        }
Example #5
0
        private Snapshot CloneAndFilterSnapshot(ISnapshot srcSnapshot)
        {
            Snapshot dstSnapshot = Snapshot.Allocate();

            dstSnapshot.Header = srcSnapshot.Header;

            EntityMapDeepCloner.Clone(dstSnapshot, srcSnapshot, new Core.Replicaton.DummyEntityMapFilter());

            // filter entities here, e.g. delete bullet

            /**
             *
             */
            return(dstSnapshot);
        }
Example #6
0
 public CompensationMapDiffHandler(IInterpolationInfo interpolationInfo)
 {
     snapshot = Snapshot.Allocate();
     this.interpolationInfo = interpolationInfo;
 }
Example #7
0
 public CompensationSnapshotHandler(
     IInterpolationInfo interpolationInfo)
 {
     _snapshot          = Snapshot.Allocate();
     _interpolationInfo = interpolationInfo;
 }