Esempio n. 1
0
        public void DoInsert(IGameEntity localEntity)
        {
            var entityKey  = localEntity.EntityKey;
            var sendFilter = _filter;

            if (_preEntitys.Contains(entityKey))
            {
                return;
            }
            if (sendFilter.IsIncludeEntity(localEntity))
            {
                if (sendFilter.IsEntitySelf(localEntity))
                {
                    _snapshot.AddEntity(localEntity.GetSelfEntityCopy(_seq));
                }
                else
                {
                    if (localEntity.HasPositionFilter)
                    {
                        var positionFilter = localEntity.GetComponent <PositionFilterComponent>();
                        var position       = localEntity.Position;
                        if (!positionFilter.Filter(position.Value, _filter.Position))
                        {
                            _snapshot.AddEntity(localEntity.GetNonSelfEntityCopy(_seq));
                        }
                    }
                    else
                    {
                        _snapshot.AddEntity(localEntity.GetNonSelfEntityCopy(_seq));
                    }
                }
            }
        }
Esempio n. 2
0
        public override void DoDiffEntityStart(IGameEntity leftEntity, IGameEntity rightEntity)
        {
            var e = CompensatioSnapshotGameEntity.Allocate(leftEntity.EntityKey);

            snapshot.AddEntity(e);
            e.ReleaseReference();
        }