public override void AcknowledgeAuthorityLoss(ComponentGroup group, ComponentSystemBase system,
                                                          Improbable.Worker.Core.Connection connection)
            {
                var authorityLossType = system.GetArchetypeChunkComponentType <AuthorityLossImminent <Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Component> >();
                var spatialEntityType = system.GetArchetypeChunkComponentType <SpatialEntityId>();

                var chunkArray = group.CreateArchetypeChunkArray(Allocator.TempJob);

                foreach (var chunk in chunkArray)
                {
                    var authorityArray       = chunk.GetNativeArray(authorityLossType);
                    var spatialEntityIdArray = chunk.GetNativeArray(spatialEntityType);

                    for (int i = 0; i < authorityArray.Length; ++i)
                    {
                        if (authorityArray[i].AcknowledgeAuthorityLoss)
                        {
                            connection.SendAuthorityLossImminentAcknowledgement(spatialEntityIdArray[i].EntityId,
                                                                                1003);
                        }
                    }
                }

                chunkArray.Dispose();
            }
Exemple #2
0
            public override void CleanComponents(NativeArray <ArchetypeChunk> chunkArray, ComponentSystemBase system,
                                                 EntityCommandBuffer buffer)
            {
                var entityType           = system.GetArchetypeChunkEntityType();
                var componentAddedType   = system.GetArchetypeChunkComponentType <ComponentAdded <global::Improbable.Gdk.PlayerLifecycle.OwningWorker.Component> >();
                var componentRemovedType = system.GetArchetypeChunkComponentType <ComponentRemoved <global::Improbable.Gdk.PlayerLifecycle.OwningWorker.Component> >();
                var receivedUpdateType   = system.GetArchetypeChunkComponentType <global::Improbable.Gdk.PlayerLifecycle.OwningWorker.ReceivedUpdates>();
                var authorityChangeType  = system.GetArchetypeChunkComponentType <AuthorityChanges <global::Improbable.Gdk.PlayerLifecycle.OwningWorker.Component> >();

                foreach (var chunk in chunkArray)
                {
                    var entities = chunk.GetNativeArray(entityType);

                    // Updates
                    if (chunk.Has(receivedUpdateType))
                    {
                        var updateArray = chunk.GetNativeArray(receivedUpdateType);
                        for (int i = 0; i < entities.Length; ++i)
                        {
                            buffer.RemoveComponent <global::Improbable.Gdk.PlayerLifecycle.OwningWorker.ReceivedUpdates>(entities[i]);
                            var updateList = updateArray[i].Updates;

                            // Pool update lists to avoid excessive allocation
                            updateList.Clear();
                            global::Improbable.Gdk.PlayerLifecycle.OwningWorker.Update.Pool.Push(updateList);

                            ReferenceTypeProviders.UpdatesProvider.Free(updateArray[i].handle);
                        }
                    }

                    // Component Added
                    if (chunk.Has(componentAddedType))
                    {
                        for (int i = 0; i < entities.Length; ++i)
                        {
                            buffer.RemoveComponent <ComponentAdded <global::Improbable.Gdk.PlayerLifecycle.OwningWorker.Component> >(entities[i]);
                        }
                    }

                    // Component Removed
                    if (chunk.Has(componentRemovedType))
                    {
                        for (int i = 0; i < entities.Length; ++i)
                        {
                            buffer.RemoveComponent <ComponentRemoved <global::Improbable.Gdk.PlayerLifecycle.OwningWorker.Component> >(entities[i]);
                        }
                    }

                    // Authority
                    if (chunk.Has(authorityChangeType))
                    {
                        var authorityChangeArray = chunk.GetNativeArray(authorityChangeType);
                        for (int i = 0; i < entities.Length; ++i)
                        {
                            buffer.RemoveComponent <AuthorityChanges <global::Improbable.Gdk.PlayerLifecycle.OwningWorker.Component> >(entities[i]);
                            AuthorityChangesProvider.Free(authorityChangeArray[i].Handle);
                        }
                    }
                }
            }
Exemple #3
0
            public void SendEvents(NativeArray <ArchetypeChunk> chunkArray, ComponentSystemBase system, ComponentUpdateSystem componentUpdateSystem)
            {
                Profiler.BeginSample("HealthComponent");

                var spatialOSEntityType     = system.GetArchetypeChunkComponentType <SpatialEntityId>(true);
                var eventHealthModifiedType = system.GetArchetypeChunkComponentType <EventSender.HealthModified>(true);
                var eventRespawnType        = system.GetArchetypeChunkComponentType <EventSender.Respawn>(true);

                foreach (var chunk in chunkArray)
                {
                    var entityIdArray            = chunk.GetNativeArray(spatialOSEntityType);
                    var eventHealthModifiedArray = chunk.GetNativeArray(eventHealthModifiedType);
                    var eventRespawnArray        = chunk.GetNativeArray(eventRespawnType);
                    for (var i = 0; i < entityIdArray.Length; i++)
                    {
                        foreach (var e in eventHealthModifiedArray[i].Events)
                        {
                            componentUpdateSystem.SendEvent(new HealthModified.Event(e), entityIdArray[i].EntityId);
                        }

                        eventHealthModifiedArray[i].Events.Clear();
                        foreach (var e in eventRespawnArray[i].Events)
                        {
                            componentUpdateSystem.SendEvent(new Respawn.Event(e), entityIdArray[i].EntityId);
                        }

                        eventRespawnArray[i].Events.Clear();
                    }
                }

                Profiler.EndSample();
            }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypePilotData         = ComponentType.ReadWrite <PilotData>();
     componentTypeLocalToWorld      = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation          = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation       = ComponentType.ReadWrite <Translation>();
     componentTypeLinkedEntityGroup = ComponentType.ReadWrite <LinkedEntityGroup>();
     ghostPilotDataType             = system.GetArchetypeChunkComponentType <PilotData>(true);
     ghostRotationType          = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType       = system.GetArchetypeChunkComponentType <Translation>(true);
     ghostLinkedEntityGroupType = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true);
     ghostChild0RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild0TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild1RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild1TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild2RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild2TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild3RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild3TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild4RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild4TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild5RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild5TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild6RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild6TranslationType = system.GetComponentDataFromEntity <Translation>(true);
 }
Exemple #5
0
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypePlayerCommandData    = ComponentType.ReadWrite <PlayerCommandData>();
     componentTypePhysicsCollider      = ComponentType.ReadWrite <PhysicsCollider>();
     componentTypePhysicsGravityFactor = ComponentType.ReadWrite <PhysicsGravityFactor>();
     componentTypePhysicsMass          = ComponentType.ReadWrite <PhysicsMass>();
     componentTypePhysicsVelocity      = ComponentType.ReadWrite <PhysicsVelocity>();
     componentTypeLocalToWorld         = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation             = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation          = ComponentType.ReadWrite <Translation>();
     componentTypeLinkedEntityGroup    = ComponentType.ReadWrite <LinkedEntityGroup>();
     ghostPlayerCommandDataType        = system.GetArchetypeChunkComponentType <PlayerCommandData>(true);
     ghostRotationType          = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType       = system.GetArchetypeChunkComponentType <Translation>(true);
     ghostLinkedEntityGroupType = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true);
     ghostChild0RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild0TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild1RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild1TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild2RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild2TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild3RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild3TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild4RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild4TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild5RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild5TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild6RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild6TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild7RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild7TranslationType = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild8RotationType    = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild8TranslationType = system.GetComponentDataFromEntity <Translation>(true);
 }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeHealth             = ComponentType.ReadWrite <Health>();
     componentTypePlayerUnit         = ComponentType.ReadWrite <PlayerUnit>();
     componentTypeUnitSelectionState = ComponentType.ReadWrite <UnitSelectionState>();
     componentTypePhysicsCollider    = ComponentType.ReadWrite <PhysicsCollider>();
     componentTypeCompositeScale     = ComponentType.ReadWrite <CompositeScale>();
     componentTypeLocalToWorld       = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation           = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation        = ComponentType.ReadWrite <Translation>();
     componentTypeLinkedEntityGroup  = ComponentType.ReadWrite <LinkedEntityGroup>();
     ghostHealthType             = system.GetArchetypeChunkComponentType <Health>(true);
     ghostPlayerUnitType         = system.GetArchetypeChunkComponentType <PlayerUnit>(true);
     ghostUnitSelectionStateType = system.GetArchetypeChunkComponentType <UnitSelectionState>(true);
     ghostRotationType           = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType        = system.GetArchetypeChunkComponentType <Translation>(true);
     ghostLinkedEntityGroupType  = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true);
     ghostChild0RotationType     = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild0TranslationType  = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild1RotationType     = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild1TranslationType  = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild2RotationType     = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild2TranslationType  = system.GetComponentDataFromEntity <Translation>(true);
     ghostChild3RotationType     = system.GetComponentDataFromEntity <Rotation>(true);
     ghostChild3TranslationType  = system.GetComponentDataFromEntity <Translation>(true);
 }
Exemple #7
0
            public override void ExecuteReplication(ComponentGroup replicationGroup, ComponentSystemBase system, global::Improbable.Worker.CInterop.Connection connection)
            {
                Profiler.BeginSample("ExhaustiveBlittableSingular");

                var chunkArray          = replicationGroup.CreateArchetypeChunkArray(Allocator.TempJob);
                var spatialOSEntityType = system.GetArchetypeChunkComponentType <SpatialEntityId>(true);
                var componentType       = system.GetArchetypeChunkComponentType <Improbable.Gdk.Tests.ExhaustiveBlittableSingular.Component>();

                foreach (var chunk in chunkArray)
                {
                    var entityIdArray  = chunk.GetNativeArray(spatialOSEntityType);
                    var componentArray = chunk.GetNativeArray(componentType);
                    for (var i = 0; i < componentArray.Length; i++)
                    {
                        var data         = componentArray[i];
                        var eventsToSend = 0;

                        if (data.IsDataDirty() || eventsToSend > 0)
                        {
                            var update = new global::Improbable.Worker.CInterop.SchemaComponentUpdate(197720);
                            Improbable.Gdk.Tests.ExhaustiveBlittableSingular.Serialization.SerializeUpdate(data, update);

                            // Send serialized update over the wire
                            connection.SendComponentUpdate(entityIdArray[i].EntityId.Id, new global::Improbable.Worker.CInterop.ComponentUpdate(update));

                            data.MarkDataClean();
                            componentArray[i] = data;
                        }
                    }
                }

                chunkArray.Dispose();
                Profiler.EndSample();
            }
Exemple #8
0
            public void SendEvents(NativeArray <ArchetypeChunk> chunkArray, ComponentSystemBase system, ComponentUpdateSystem componentUpdateSystem)
            {
                Profiler.BeginSample("NonBlittableComponent");

                var spatialOSEntityType  = system.GetArchetypeChunkComponentType <SpatialEntityId>(true);
                var eventFirstEventType  = system.GetArchetypeChunkComponentType <EventSender.FirstEvent>(true);
                var eventSecondEventType = system.GetArchetypeChunkComponentType <EventSender.SecondEvent>(true);

                foreach (var chunk in chunkArray)
                {
                    var entityIdArray         = chunk.GetNativeArray(spatialOSEntityType);
                    var eventFirstEventArray  = chunk.GetNativeArray(eventFirstEventType);
                    var eventSecondEventArray = chunk.GetNativeArray(eventSecondEventType);
                    for (var i = 0; i < entityIdArray.Length; i++)
                    {
                        foreach (var e in eventFirstEventArray[i].Events)
                        {
                            componentUpdateSystem.SendEvent(new FirstEvent.Event(e), entityIdArray[i].EntityId);
                        }

                        eventFirstEventArray[i].Events.Clear();
                        foreach (var e in eventSecondEventArray[i].Events)
                        {
                            componentUpdateSystem.SendEvent(new SecondEvent.Event(e), entityIdArray[i].EntityId);
                        }

                        eventSecondEventArray[i].Events.Clear();
                    }
                }

                Profiler.EndSample();
            }
Exemple #9
0
            public override void ExecuteReplication(ComponentGroup replicationGroup, ComponentSystemBase system, global::Improbable.Worker.Core.Connection connection)
            {
                Profiler.BeginSample("NestedComponent");

                var chunkArray          = replicationGroup.CreateArchetypeChunkArray(Allocator.TempJob);
                var spatialOSEntityType = system.GetArchetypeChunkComponentType <SpatialEntityId>(true);
                var componentType       = system.GetArchetypeChunkComponentType <Improbable.Gdk.Tests.NestedComponent.Component>();

                foreach (var chunk in chunkArray)
                {
                    var entityIdArray  = chunk.GetNativeArray(spatialOSEntityType);
                    var componentArray = chunk.GetNativeArray(componentType);
                    for (var i = 0; i < componentArray.Length; i++)
                    {
                        var data        = componentArray[i];
                        var dirtyEvents = 0;

                        if (data.DirtyBit || dirtyEvents > 0)
                        {
                            var update = new global::Improbable.Worker.Core.SchemaComponentUpdate(20152);
                            Improbable.Gdk.Tests.NestedComponent.Serialization.SerializeUpdate(data, update);

                            // Send serialized update over the wire
                            connection.SendComponentUpdate(entityIdArray[i].EntityId, new global::Improbable.Worker.Core.ComponentUpdate(update));

                            data.DirtyBit     = false;
                            componentArray[i] = data;
                        }
                    }
                }

                chunkArray.Dispose();
                Profiler.EndSample();
            }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeAsteroidTagComponentData = ComponentType.ReadWrite <AsteroidTagComponentData>();
     componentTypeTranslation = ComponentType.ReadWrite <Translation>();
     ghostTranslationType     = system.GetArchetypeChunkComponentType <Translation>();
     componentTypeRotation    = ComponentType.ReadWrite <Rotation>();
     ghostRotationType        = system.GetArchetypeChunkComponentType <Rotation>();
 }
Exemple #11
0
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation     = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation  = ComponentType.ReadWrite <Translation>();
     ghostRotationType         = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType      = system.GetArchetypeChunkComponentType <Translation>(true);
 }
    public void BeginSerialize(ComponentSystemBase system)
    {
        ghostPositionType = system.GetArchetypeChunkComponentType <Translation>();
        ghostRotationType = system.GetArchetypeChunkComponentType <Rotation>();

        bulletTagType = ComponentType.ReadWrite <BulletTagComponentData>();
        positionType  = ComponentType.ReadWrite <Translation>();
        rotationType  = ComponentType.ReadWrite <Rotation>();
    }
Exemple #13
0
            public void SendUpdates(
                NativeArray <ArchetypeChunk> chunkArray,
                ComponentSystemBase system,
                EntityManager entityManager,
                ComponentUpdateSystem componentUpdateSystem)
            {
                using (componentMarker.Auto())
                {
                    var spatialOSEntityType = system.GetArchetypeChunkComponentType <SpatialEntityId>(true);
                    var componentType       = system.GetArchetypeChunkComponentType <global::Improbable.DependentSchema.DependentComponent.Component>();

                    foreach (var chunk in chunkArray)
                    {
                        var entityIdArray  = chunk.GetNativeArray(spatialOSEntityType);
                        var componentArray = chunk.GetNativeArray(componentType);

                        for (var i = 0; i < componentArray.Length; i++)
                        {
                            var data = componentArray[i];

                            if (data.IsDataDirty())
                            {
                                var update = new Update();

                                if (data.IsDataDirty(0))
                                {
                                    update.A = data.A;
                                }

                                if (data.IsDataDirty(1))
                                {
                                    update.B = data.B;
                                }

                                if (data.IsDataDirty(2))
                                {
                                    update.C = data.C;
                                }

                                if (data.IsDataDirty(3))
                                {
                                    update.D = data.D;
                                }

                                if (data.IsDataDirty(4))
                                {
                                    update.E = data.E;
                                }

                                componentUpdateSystem.SendUpdate(in update, entityIdArray[i].EntityId);
                                data.MarkDataClean();
                                componentArray[i] = data;
                            }
                        }
                    }
                }
            }
Exemple #14
0
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeMovableCharacterComponent = ComponentType.ReadWrite <MovableCharacterComponent>();
     componentTypePlayerData            = ComponentType.ReadWrite <PlayerData>();
     componentTypeTranslation           = ComponentType.ReadWrite <Translation>();
     ghostMovableCharacterComponentType = system.GetArchetypeChunkComponentType <MovableCharacterComponent>(true);
     ghostPlayerDataType  = system.GetArchetypeChunkComponentType <PlayerData>(true);
     ghostTranslationType = system.GetArchetypeChunkComponentType <Translation>(true);
 }
Exemple #15
0
            public void SendUpdates(
                NativeArray <ArchetypeChunk> chunkArray,
                ComponentSystemBase system,
                EntityManager entityManager,
                ComponentUpdateSystem componentUpdateSystem)
            {
                Profiler.BeginSample("Worker");

                var spatialOSEntityType = system.GetArchetypeChunkComponentType <SpatialEntityId>(true);
                var componentType       = system.GetArchetypeChunkComponentType <global::Improbable.Restricted.Worker.Component>();

                var authorityType = system.GetArchetypeChunkSharedComponentType <ComponentAuthority>();

                foreach (var chunk in chunkArray)
                {
                    var entityIdArray  = chunk.GetNativeArray(spatialOSEntityType);
                    var componentArray = chunk.GetNativeArray(componentType);

                    var authorityIndex = chunk.GetSharedComponentIndex(authorityType);

                    if (!entityManager.GetSharedComponentData <ComponentAuthority>(authorityIndex).HasAuthority)
                    {
                        continue;
                    }

                    for (var i = 0; i < componentArray.Length; i++)
                    {
                        var data = componentArray[i];
                        if (data.IsDataDirty())
                        {
                            Update update = new Update();

                            if (data.IsDataDirty(0))
                            {
                                update.WorkerId = data.WorkerId;
                            }

                            if (data.IsDataDirty(1))
                            {
                                update.WorkerType = data.WorkerType;
                            }

                            if (data.IsDataDirty(2))
                            {
                                update.Connection = data.Connection;
                            }

                            componentUpdateSystem.SendUpdate(in update, entityIdArray[i].EntityId);
                            data.MarkDataClean();
                            componentArray[i] = data;
                        }
                    }
                }

                Profiler.EndSample();
            }
Exemple #16
0
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeBulletTagComponentData = ComponentType.ReadWrite <BulletTagComponentData>();
     componentTypeTranslation            = ComponentType.ReadWrite <Translation>();
     ghostTranslationType  = system.GetArchetypeChunkComponentType <Translation>();
     componentTypeRotation = ComponentType.ReadWrite <Rotation>();
     ghostRotationType     = system.GetArchetypeChunkComponentType <Rotation>();
     componentTypePlayerIdComponentData = ComponentType.ReadWrite <PlayerIdComponentData>();
     ghostPlayerIdComponentDataType     = system.GetArchetypeChunkComponentType <PlayerIdComponentData>();
 }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeAsteroidTagComponentData = ComponentType.ReadWrite <AsteroidTagComponentData>();
     componentTypeCollisionSphereComponent = ComponentType.ReadWrite <CollisionSphereComponent>();
     componentTypeRotation    = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation = ComponentType.ReadWrite <Translation>();
     componentTypeVelocity    = ComponentType.ReadWrite <Velocity>();
     ghostRotationType        = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType     = system.GetArchetypeChunkComponentType <Translation>(true);
 }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeAbilityCollectionAbilityEntry = ComponentType.ReadWrite <AbilityCollection.AbilityEntry>();
     componentTypeAbilityCollectionState        = ComponentType.ReadWrite <AbilityCollection.State>();
     componentTypeAbilityOwnerOwnedAbility      = ComponentType.ReadWrite <AbilityOwner.OwnedAbility>();
     componentTypeAbilityOwnerOwnedCollection   = ComponentType.ReadWrite <AbilityOwner.OwnedCollection>();
     componentTypeAbilityOwnerState             = ComponentType.ReadWrite <AbilityOwner.State>();
     componentTypeAimDataData = ComponentType.ReadWrite <AimData.Data>();
     componentTypeAnimSourceControllerRigData           = ComponentType.ReadWrite <AnimSourceController.RigData>();
     componentTypeAnimSourceControllerSettings          = ComponentType.ReadWrite <AnimSourceController.Settings>();
     componentTypeCharacterInterpolatedData             = ComponentType.ReadWrite <Character.InterpolatedData>();
     componentTypeCharacterPredictedData                = ComponentType.ReadWrite <Character.PredictedData>();
     componentTypeCharacterReplicatedData               = ComponentType.ReadWrite <Character.ReplicatedData>();
     componentTypeCharacterSettings                     = ComponentType.ReadWrite <Character.Settings>();
     componentTypeCharacterControllerComponentData      = ComponentType.ReadWrite <CharacterControllerComponentData>();
     componentTypeCharacterControllerGroundSupportData  = ComponentType.ReadWrite <CharacterControllerGroundSupportData>();
     componentTypeCharacterControllerInitializationData = ComponentType.ReadWrite <CharacterControllerInitializationData>();
     componentTypeCharacterControllerMoveQuery          = ComponentType.ReadWrite <CharacterControllerMoveQuery>();
     componentTypeCharacterControllerMoveResult         = ComponentType.ReadWrite <CharacterControllerMoveResult>();
     componentTypeCharacterControllerVelocity           = ComponentType.ReadWrite <CharacterControllerVelocity>();
     componentTypeDamageEvent            = ComponentType.ReadWrite <DamageEvent>();
     componentTypeDamageHistoryData      = ComponentType.ReadWrite <DamageHistoryData>();
     componentTypeHealthStateData        = ComponentType.ReadWrite <HealthStateData>();
     componentTypeInventoryInternalState = ComponentType.ReadWrite <Inventory.InternalState>();
     componentTypeInventoryItemEntry     = ComponentType.ReadWrite <Inventory.ItemEntry>();
     componentTypeInventoryState         = ComponentType.ReadWrite <Inventory.State>();
     componentTypePartOwnerInputState    = ComponentType.ReadWrite <PartOwner.InputState>();
     componentTypePartOwnerRegistryAsset = ComponentType.ReadWrite <PartOwner.RegistryAsset>();
     componentTypePlayerOwnerPlayerId    = ComponentType.ReadWrite <Player.OwnerPlayerId>();
     componentTypePlayerControlledState  = ComponentType.ReadWrite <PlayerControlled.State>();
     componentTypeSkeletonRenderer       = ComponentType.ReadWrite <SkeletonRenderer>();
     componentTypeLocalToWorld           = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation                           = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation                        = ComponentType.ReadWrite <Translation>();
     componentTypeLinkedEntityGroup                  = ComponentType.ReadWrite <LinkedEntityGroup>();
     ghostCharacterInterpolatedDataType              = system.GetArchetypeChunkComponentType <Character.InterpolatedData>(true);
     ghostCharacterPredictedDataType                 = system.GetArchetypeChunkComponentType <Character.PredictedData>(true);
     ghostCharacterReplicatedDataType                = system.GetArchetypeChunkComponentType <Character.ReplicatedData>(true);
     ghostCharacterControllerGroundSupportDataType   = system.GetArchetypeChunkComponentType <CharacterControllerGroundSupportData>(true);
     ghostCharacterControllerMoveResultType          = system.GetArchetypeChunkComponentType <CharacterControllerMoveResult>(true);
     ghostCharacterControllerVelocityType            = system.GetArchetypeChunkComponentType <CharacterControllerVelocity>(true);
     ghostHealthStateDataType                        = system.GetArchetypeChunkComponentType <HealthStateData>(true);
     ghostInventoryStateType                         = system.GetArchetypeChunkComponentType <Inventory.State>(true);
     ghostPlayerOwnerPlayerIdType                    = system.GetArchetypeChunkComponentType <Player.OwnerPlayerId>(true);
     ghostPlayerControlledStateType                  = system.GetArchetypeChunkComponentType <PlayerControlled.State>(true);
     ghostLinkedEntityGroupType                      = system.GetArchetypeChunkBufferType <LinkedEntityGroup>(true);
     ghostChild0AbilityAbilityControlType            = system.GetComponentDataFromEntity <Ability.AbilityControl>(true);
     ghostChild0AbilityMovementInterpolatedStateType = system.GetComponentDataFromEntity <AbilityMovement.InterpolatedState>(true);
     ghostChild0AbilityMovementPredictedStateType    = system.GetComponentDataFromEntity <AbilityMovement.PredictedState>(true);
     ghostChild1AbilityAbilityControlType            = system.GetComponentDataFromEntity <Ability.AbilityControl>(true);
     ghostChild2AbilityAbilityControlType            = system.GetComponentDataFromEntity <Ability.AbilityControl>(true);
     ghostChild2AbilityDashPredictedStateType        = system.GetComponentDataFromEntity <AbilityDash.PredictedState>(true);
     ghostChild3AbilityAbilityControlType            = system.GetComponentDataFromEntity <Ability.AbilityControl>(true);
     ghostChild3AbilityClimbPredictedStateType       = system.GetComponentDataFromEntity <AbilityClimb.PredictedState>(true);
 }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeMovableCubeComponent = ComponentType.ReadWrite <MovableCubeComponent>();
     componentTypeTestCommandData      = ComponentType.ReadWrite <TestCommandData>();
     componentTypeLocalToWorld         = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation             = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation          = ComponentType.ReadWrite <Translation>();
     ghostMovableCubeComponentType     = system.GetArchetypeChunkComponentType <MovableCubeComponent>(true);
     ghostRotationType    = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType = system.GetArchetypeChunkComponentType <Translation>(true);
 }
Exemple #20
0
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeLocalToWorld    = ComponentType.ReadWrite <LocalToWorld>();
     componentTypePhysicsCollider = ComponentType.ReadWrite <PhysicsCollider>();
     componentTypePhysicsDamping  = ComponentType.ReadWrite <PhysicsDamping>();
     componentTypePhysicsMass     = ComponentType.ReadWrite <PhysicsMass>();
     componentTypePhysicsVelocity = ComponentType.ReadWrite <PhysicsVelocity>();
     componentTypeRotation        = ComponentType.ReadWrite <Rotation>();
     ghostRotationType            = system.GetArchetypeChunkComponentType <Rotation>();
     componentTypeTranslation     = ComponentType.ReadWrite <Translation>();
     ghostTranslationType         = system.GetArchetypeChunkComponentType <Translation>();
 }
Exemple #21
0
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypePaddleMoveableComponent = ComponentType.ReadWrite <PaddleMoveableComponent>();
     componentTypePhysicsCollider         = ComponentType.ReadWrite <PhysicsCollider>();
     componentTypeCompositeScale          = ComponentType.ReadWrite <CompositeScale>();
     componentTypeLocalToWorld            = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation            = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation         = ComponentType.ReadWrite <Translation>();
     ghostPaddleMoveableComponentType = system.GetArchetypeChunkComponentType <PaddleMoveableComponent>(true);
     ghostRotationType    = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType = system.GetArchetypeChunkComponentType <Translation>(true);
 }
Exemple #22
0
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeCommandDataInterpolationDelay = ComponentType.ReadWrite <CommandDataInterpolationDelay>();
     componentTypeLagCompensationTestCommand    = ComponentType.ReadWrite <LagCompensationTestCommand>();
     componentTypeLagCompensationTestPlayer     = ComponentType.ReadWrite <LagCompensationTestPlayer>();
     componentTypeLocalToWorld          = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation              = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation           = ComponentType.ReadWrite <Translation>();
     ghostLagCompensationTestPlayerType = system.GetArchetypeChunkComponentType <LagCompensationTestPlayer>(true);
     ghostRotationType    = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType = system.GetArchetypeChunkComponentType <Translation>(true);
 }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypePhysicsCollider       = ComponentType.ReadWrite <PhysicsCollider>();
     componentTypePhysicsGravityFactor  = ComponentType.ReadWrite <PhysicsGravityFactor>();
     componentTypePhysicsMass           = ComponentType.ReadWrite <PhysicsMass>();
     componentTypePhysicsVelocity       = ComponentType.ReadWrite <PhysicsVelocity>();
     componentTypePerInstanceCullingTag = ComponentType.ReadWrite <PerInstanceCullingTag>();
     componentTypeLocalToWorld          = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation    = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation = ComponentType.ReadWrite <Translation>();
     ghostRotationType        = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType     = system.GetArchetypeChunkComponentType <Translation>(true);
 }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeCameraRigChild     = ComponentType.ReadWrite <CameraRigChild>();
     componentTypePilotData          = ComponentType.ReadWrite <PilotData>();
     componentTypePilotSetupRequired = ComponentType.ReadWrite <PilotSetupRequired>();
     componentTypeLocalToWorld       = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation           = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation        = ComponentType.ReadWrite <Translation>();
     ghostCameraRigChildType         = system.GetArchetypeChunkComponentType <CameraRigChild>(true);
     ghostPilotDataType   = system.GetArchetypeChunkComponentType <PilotData>(true);
     ghostRotationType    = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType = system.GetArchetypeChunkComponentType <Translation>(true);
 }
Exemple #25
0
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeMovableCubeComponent  = ComponentType.ReadWrite <MovableCubeComponent>();
     componentTypePerInstanceCullingTag = ComponentType.ReadWrite <PerInstanceCullingTag>();
     componentTypeRenderBounds          = ComponentType.ReadWrite <RenderBounds>();
     componentTypeRenderMesh            = ComponentType.ReadWrite <RenderMesh>();
     componentTypeLocalToWorld          = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation         = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation      = ComponentType.ReadWrite <Translation>();
     ghostMovableCubeComponentType = system.GetArchetypeChunkComponentType <MovableCubeComponent>(true);
     ghostRotationType             = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType          = system.GetArchetypeChunkComponentType <Translation>(true);
 }
Exemple #26
0
    public void BeginSerialize(ComponentSystemBase system)
    {
        ghostPositionType = system.GetArchetypeChunkComponentType <Translation>();
        ghostRotationType = system.GetArchetypeChunkComponentType <Rotation>();
        ghostStateType    = system.GetArchetypeChunkComponentType <ShipStateComponentData>();
        ghostPlayerType   = system.GetArchetypeChunkComponentType <PlayerIdComponentData>();

        shipTagType   = ComponentType.ReadWrite <ShipTagComponentData>();
        positionType  = ComponentType.ReadWrite <Translation>();
        rotationType  = ComponentType.ReadWrite <Rotation>();
        shipStateType = ComponentType.ReadWrite <ShipStateComponentData>();
        playerIdType  = ComponentType.ReadWrite <PlayerIdComponentData>();
    }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeUnitSelectionVisual   = ComponentType.ReadWrite <UnitSelectionVisual>();
     componentTypePerInstanceCullingTag = ComponentType.ReadWrite <PerInstanceCullingTag>();
     componentTypeRenderBounds          = ComponentType.ReadWrite <RenderBounds>();
     componentTypeRenderMesh            = ComponentType.ReadWrite <RenderMesh>();
     componentTypeLocalToWorld          = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeNonUniformScale       = ComponentType.ReadWrite <NonUniformScale>();
     componentTypeRotation    = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation = ComponentType.ReadWrite <Translation>();
     ghostRotationType        = system.GetArchetypeChunkComponentType <Rotation>(true);
     ghostTranslationType     = system.GetArchetypeChunkComponentType <Translation>(true);
 }
            public override void ExecuteReplication(ComponentGroup replicationGroup, ComponentSystemBase system, global::Improbable.Worker.Core.Connection connection)
            {
                Profiler.BeginSample("ComponentWithNoFieldsWithEvents");

                var chunkArray          = replicationGroup.CreateArchetypeChunkArray(Allocator.TempJob);
                var spatialOSEntityType = system.GetArchetypeChunkComponentType <SpatialEntityId>(true);
                var componentType       = system.GetArchetypeChunkComponentType <Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithEvents.Component>();
                var eventEvtType        = system.GetArchetypeChunkComponentType <EventSender.Evt>(true);

                foreach (var chunk in chunkArray)
                {
                    var entityIdArray  = chunk.GetNativeArray(spatialOSEntityType);
                    var componentArray = chunk.GetNativeArray(componentType);
                    var eventEvtArray  = chunk.GetNativeArray(eventEvtType);
                    for (var i = 0; i < componentArray.Length; i++)
                    {
                        var data        = componentArray[i];
                        var dirtyEvents = 0;
                        var eventsEvt   = eventEvtArray[i].Events;
                        dirtyEvents += eventsEvt.Count;

                        if (data.DirtyBit || dirtyEvents > 0)
                        {
                            var update = new global::Improbable.Worker.Core.SchemaComponentUpdate(1004);
                            Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithEvents.Serialization.SerializeUpdate(data, update);

                            // Serialize events
                            var eventsObject = update.GetEvents();
                            if (eventsEvt.Count > 0)
                            {
                                foreach (var e in eventsEvt)
                                {
                                    var obj = eventsObject.AddObject(1);
                                    global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty.Serialization.Serialize(e, obj);
                                }

                                eventsEvt.Clear();
                            }

                            // Send serialized update over the wire
                            connection.SendComponentUpdate(entityIdArray[i].EntityId, new global::Improbable.Worker.Core.ComponentUpdate(update));

                            data.DirtyBit     = false;
                            componentArray[i] = data;
                        }
                    }
                }

                chunkArray.Dispose();
                Profiler.EndSample();
            }
Exemple #29
0
            public override void ExecuteReplication(ComponentGroup replicationGroup, ComponentSystemBase system, global::Improbable.Worker.CInterop.Connection connection)
            {
                Profiler.BeginSample("Connection");

                var chunkArray          = replicationGroup.CreateArchetypeChunkArray(Allocator.TempJob);
                var spatialOSEntityType = system.GetArchetypeChunkComponentType <SpatialEntityId>(true);
                var componentType       = system.GetArchetypeChunkComponentType <Improbable.Gdk.Tests.AlternateSchemaSyntax.Connection.Component>();
                var eventMyEventType    = system.GetArchetypeChunkComponentType <EventSender.MyEvent>(true);

                foreach (var chunk in chunkArray)
                {
                    var entityIdArray     = chunk.GetNativeArray(spatialOSEntityType);
                    var componentArray    = chunk.GetNativeArray(componentType);
                    var eventMyEventArray = chunk.GetNativeArray(eventMyEventType);
                    for (var i = 0; i < componentArray.Length; i++)
                    {
                        var data          = componentArray[i];
                        var eventsToSend  = 0;
                        var eventsMyEvent = eventMyEventArray[i].Events;
                        eventsToSend += eventsMyEvent.Count;

                        if (data.IsDataDirty() || eventsToSend > 0)
                        {
                            var update = new global::Improbable.Worker.CInterop.SchemaComponentUpdate(1105);
                            Improbable.Gdk.Tests.AlternateSchemaSyntax.Connection.Serialization.SerializeUpdate(data, update);

                            // Serialize events
                            var eventsObject = update.GetEvents();
                            if (eventsMyEvent.Count > 0)
                            {
                                foreach (var e in eventsMyEvent)
                                {
                                    var obj = eventsObject.AddObject(1);
                                    global::Improbable.Gdk.Tests.AlternateSchemaSyntax.RandomDataType.Serialization.Serialize(e, obj);
                                }

                                eventsMyEvent.Clear();
                            }

                            // Send serialized update over the wire
                            connection.SendComponentUpdate(entityIdArray[i].EntityId.Id, new global::Improbable.Worker.CInterop.ComponentUpdate(update), UpdateParameters);

                            data.MarkDataClean();
                            componentArray[i] = data;
                        }
                    }
                }

                chunkArray.Dispose();
                Profiler.EndSample();
            }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeTranslation            = ComponentType.ReadWrite <Translation>();
     ghostTranslationType                = system.GetArchetypeChunkComponentType <Translation>();
     componentTypeRotation               = ComponentType.ReadWrite <Rotation>();
     ghostRotationType                   = system.GetArchetypeChunkComponentType <Rotation>();
     componentTypeVelocity               = ComponentType.ReadWrite <Velocity>();
     ghostVelocityType                   = system.GetArchetypeChunkComponentType <Velocity>();
     componentTypeShipStateComponentData = ComponentType.ReadWrite <ShipStateComponentData>();
     ghostShipStateComponentDataType     = system.GetArchetypeChunkComponentType <ShipStateComponentData>();
     componentTypePlayerIdComponentData  = ComponentType.ReadWrite <PlayerIdComponentData>();
     ghostPlayerIdComponentDataType      = system.GetArchetypeChunkComponentType <PlayerIdComponentData>();
     componentTypeShipTagComponentData   = ComponentType.ReadWrite <ShipTagComponentData>();
 }