Exemplo n.º 1
0
 public virtual void Next()
 {
     Sync(_currentState + 1);
     if (_synchronizer != null)
     {
         _synchronizer.Sync(_currentState);
     }
 }
Exemplo n.º 2
0
        private unsafe void Synchronize()
        {
            if (Synchronizer is null || View is null)
            {
                return;
            }
            var chunks = _query.CreateArchetypeChunkArray(Allocator.TempJob);
            var typePhysicsVelocity = GetArchetypeChunkComponentType <PhysicsVelocity>();
            var typeTranslation     = GetArchetypeChunkComponentType <Translation>();
            var typeRotation        = GetArchetypeChunkComponentType <Rotation>();
            var typeTeamTag         = GetArchetypeChunkComponentType <TeamTag>(true);

            foreach (var chunk in chunks)
            {
                var velocities   = chunk.GetNativeArray(typePhysicsVelocity);
                var translations = chunk.GetNativeArray(typeTranslation);
                var rotations    = chunk.GetNativeArray(typeRotation);
                var teamTags     = chunk.GetNativeArray(typeTeamTag);
                for (var i = 0; i < teamTags.Length; i++)
                {
                    if (teamTags[i].Id != View.OwnerActorNr)
                    {
                        continue;
                    }
                    Synchronizer.Sync(
                        ((Translation *)NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks(translations))[i],
                        ((Rotation *)NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks(rotations))[i],
                        ((PhysicsVelocity *)NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks(velocities))[i]);
                    goto RETURN;
                }
            }
RETURN:
            chunks.Dispose();
        }
Exemplo n.º 3
0
 private void Synchronize(ISynchronizer synchronizer)
 {
     while (!token.IsCancellationRequested)
     {
         synchronizer.Sync();
     }
 }
Exemplo n.º 4
0
 public void Sync()
 {
     try
     {
         decoratedSynchronizer.Sync();
     }
     catch (Exception ex)
     {
         logger.LogError($"{synchronizerName} failed", ex);
     }
 }
Exemplo n.º 5
0
 public void Start()
 {
     cacheLoader.Refresh();
     synchronizer.Sync();
 }