示例#1
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);
 }
    protected override void OnUpdate()
    {
        ArchetypeChunkComponentType <GameinputComponent> inputData = GetArchetypeChunkComponentType <GameinputComponent>(false);
        NativeArray <ArchetypeChunk> inputdataChunk = inputSystem.CreateArchetypeChunkArray(Allocator.TempJob);

        if (inputdataChunk.Length == 0)
        {
            inputdataChunk.Dispose();
            return;
        }

        for (int chunkIndex = 0; chunkIndex < inputdataChunk.Length; chunkIndex++)
        {
            ArchetypeChunk chunk     = inputdataChunk[chunkIndex];
            int            dataCount = chunk.Count;

            NativeArray <GameinputComponent> inputDataArray = chunk.GetNativeArray(inputData);

            for (int dataindex = 0; dataindex < dataCount; dataindex++)
            {
                GameinputComponent gameInput = inputDataArray[dataindex];

                bool keyPress = Input.GetKeyDown(KeyCode.C);

                gameInput.keyPress = keyPress ? 1 : 0;
            }
        }
        inputdataChunk.Dispose();
    }
示例#3
0
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypeLagPlayer       = ComponentType.ReadWrite <LagPlayer>();
     componentTypeRayTraceCommand = ComponentType.ReadWrite <RayTraceCommand>();
     componentTypeCommandDataInterpolationDelay = ComponentType.ReadWrite <CommandDataInterpolationDelay>();
     ghostLagPlayerType = system.GetArchetypeChunkComponentType <LagPlayer>(true);
 }
        protected override JobHandle OnUpdate(JobHandle inputDependencies)
        {
            m_ExportPhysicsWorldSystem.FinalJobHandle.Complete();

            NativeArray <ArchetypeChunk> chunks = m_motorQuery.CreateArchetypeChunkArray(Allocator.TempJob);

            ArchetypeChunkComponentType <KinematicMotor>  chunkKinematicMotorType  = GetArchetypeChunkComponentType <KinematicMotor>();
            ArchetypeChunkComponentType <Movement>        chunkMovementType        = GetArchetypeChunkComponentType <Movement>();
            ArchetypeChunkComponentType <PhysicsCollider> chunkPhysicsColliderType = GetArchetypeChunkComponentType <PhysicsCollider>();
            ArchetypeChunkComponentType <Translation>     chunkTranslationType     = GetArchetypeChunkComponentType <Translation>();
            ArchetypeChunkComponentType <Rotation>        chunkRotationType        = GetArchetypeChunkComponentType <Rotation>();

            MotorJob motorJob = new MotorJob
            {
                Chunks = chunks,

                World = m_buildPhysicsWorld.PhysicsWorld,

                DeltaTime = UnityEngine.Time.fixedDeltaTime,

                KinematicMotorType  = chunkKinematicMotorType,
                PhysicsColliderType = chunkPhysicsColliderType,
                MovementType        = chunkMovementType,
                TranslationType     = chunkTranslationType,
                RotationType        = chunkRotationType,

                DistanceHits           = new NativeArray <DistanceHit>(KinematicMotorUtilities.MAX_QUERIES, Allocator.TempJob),
                ColliderCastHits       = new NativeArray <ColliderCastHit>(KinematicMotorUtilities.MAX_QUERIES, Allocator.TempJob),
                SurfaceConstraintInfos = new NativeArray <SurfaceConstraintInfo>(KinematicMotorUtilities.MAX_QUERIES * 4, Allocator.TempJob)
            };

            inputDependencies = motorJob.Schedule(m_motorQuery, inputDependencies);

            return(inputDependencies);
        }
 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);
 }
示例#6
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            EntityCommandBuffer          buffer = bufferSystem.CreateCommandBuffer();
            NativeArray <ArchetypeChunk> chunks = particleQuery.CreateArchetypeChunkArray(Allocator.TempJob);

            ArchetypeChunkEntityType entityType = GetArchetypeChunkEntityType();
            ArchetypeChunkComponentType <Translation> transformType = GetArchetypeChunkComponentType <Translation>(false);
            ArchetypeChunkComponentType <Mass>        massType      = GetArchetypeChunkComponentType <Mass>(false);
            ArchetypeChunkComponentType <Radius>      radiusType    = GetArchetypeChunkComponentType <Radius>(false);
            ArchetypeChunkComponentType <Scale>       scaleType     = GetArchetypeChunkComponentType <Scale>(false);

            ArchetypeChunkComponentType <Velocity> velocityType = GetArchetypeChunkComponentType <Velocity>(false);

            entitiesToDestroy.Clear();

            CollideMergeJob job = new CollideMergeJob
            {
                ParticleDensity   = ParticleDensity,
                Chunks            = chunks,
                EntityType        = entityType,
                PositionType      = transformType,
                MassType          = massType,
                RadiusType        = radiusType,
                ScaleType         = scaleType,
                VelocityType      = velocityType,
                EntitiesToDestroy = entitiesToDestroy,
                DestructionBuffer = buffer
            };

            return(job.Schedule(inputDeps));
        }
 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);
 }
示例#8
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        //Timer specific
        var startTimerJob = new StartTimerJob();
        var handle        = startTimerJob.Schedule(inputDeps);
        //Timer specific

        EntityQuery query = GetEntityQuery(typeof(Velocity), ComponentType.ReadOnly <Translation>(),
                                           ComponentType.ReadOnly <ORCATag>());

        ArchetypeChunkComponentType <Translation> translationChunk = GetArchetypeChunkComponentType <Translation>(true);
        ArchetypeChunkComponentType <Velocity>    velocityChunk    = GetArchetypeChunkComponentType <Velocity>(false);

        ORCAJob orcaJob = new ORCAJob
        {
            translationType = translationChunk,
            velocityType    = velocityChunk,
            quadrantMap     = QuadrantSystem.quadrantMultiHashMap,
            maxNeighbors    = Blackboard.Instance.MaxNeighbors,
            neighborsDist   = Blackboard.Instance.NeighborsDist,
            radius          = Blackboard.Instance.Radius,
            invTimeHorizon  = 1.0f / Blackboard.Instance.TimeHorizon,
            dt = UnityEngine.Time.deltaTime,
        };

        var handle2 = orcaJob.Schedule(query, handle);

        //Timer specific
        var endTimerJob = new EndTimerJob();

        timerRecoder.RegisterTimeInMS(time);
        //Timer specific

        return(endTimerJob.Schedule(handle2));
    }
示例#9
0
        protected override void OnUpdate()
        {
            _firstType  = GetArchetypeChunkComponentType <FirstTag>(true);
            _secondType = GetArchetypeChunkComponentType <SecondTag>(true);
            _randomType = GetArchetypeChunkComponentType <RandomValue>(true);
            var    chunks       = EntityManager.CreateArchetypeChunkArray(_query, Allocator.TempJob);
            double noTagsSum    = 0;
            double firstTagSum  = 0;
            double secondTagSum = 0;
            double totalSum     = 0;

            for (int i = 0; i < chunks.Length; i++)
            {
                var chunk     = chunks[i];
                var firstTag  = chunk.Has(_firstType);
                var secondTag = chunk.Has(_secondType);
                var array     = chunk.GetNativeArray(_randomType);
                totalSum += CalcSumValues(array);
                if (firstTag)
                {
                    firstTagSum += CalcSumValues(array);
                }
                if (secondTag)
                {
                    secondTagSum += CalcSumValues(array);
                }
                else if (!firstTag)
                {
                    noTagsSum += CalcSumValues(array);
                }
            }
            chunks.Dispose();
            InitializeChunkIterationWorld.LogSumResults(this, noTagsSum, firstTagSum, secondTagSum, totalSum);
        }
示例#10
0
        private unsafe void RenderMeshWithoutColors(
            ArchetypeChunkSharedComponentType <RenderMesh> renderMeshType,
            ArchetypeChunkComponentType <LocalToWorld> localToWorldType)
        {
            var chunks = this.renderMeshWithoutColors.CreateArchetypeChunkArray(Allocator.TempJob);

            for (int i = 0; i < chunks.Length; i++)
            {
                var chunk             = chunks[i];
                var renderMesh        = chunk.GetSharedComponentData(renderMeshType, this.EntityManager);
                var localToWorldArray = chunk.GetNativeArray(localToWorldType);

                var matrix4x4Array = new Matrix4x4[chunk.Count];
                fixed(void *matrixPointer = &matrix4x4Array[0])
                {
                    var localToWorldPointer = localToWorldArray.GetUnsafeReadOnlyPtr();

                    UnsafeUtility.MemCpy(matrixPointer, localToWorldPointer, sizeof(Matrix4x4) * chunk.Count);
                }

                Graphics.DrawMeshInstanced(renderMesh.Mesh, 0, renderMesh.Material, matrix4x4Array);
            }

            chunks.Dispose();
        }
示例#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)
 {
     componentTypeAsteroidTagComponentData = ComponentType.ReadWrite <AsteroidTagComponentData>();
     componentTypeTranslation = ComponentType.ReadWrite <Translation>();
     ghostTranslationType     = system.GetArchetypeChunkComponentType <Translation>();
     componentTypeRotation    = ComponentType.ReadWrite <Rotation>();
     ghostRotationType        = system.GetArchetypeChunkComponentType <Rotation>();
 }
示例#13
0
    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>();
    }
 public void BeginSerialize(ComponentSystemBase system)
 {
     componentTypePlayerState = ComponentType.ReadWrite <Player.State>();
     componentTypePlayerCharacterControlState = ComponentType.ReadWrite <PlayerCharacterControl.State>();
     componentTypeLocalToWorld = ComponentType.ReadWrite <LocalToWorld>();
     componentTypeRotation     = ComponentType.ReadWrite <Rotation>();
     componentTypeTranslation  = ComponentType.ReadWrite <Translation>();
     ghostPlayerStateType      = system.GetArchetypeChunkComponentType <Player.State>(true);
 }
示例#15
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);
 }
 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);
 }
示例#17
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)
 {
     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);
 }
示例#19
0
 public ComponentFixedGrid2D(ArchetypeChunkComponentType <T> type, ChunksFixedGrid2D chunkGrid)
 {
     Type               = type;
     ChunkGrid          = chunkGrid;
     ChunkCount         = chunkGrid.ChunkCount;
     ChunkComponentData = new NativeArray <UIntPtr>(ChunkCount, Allocator.Persistent);
     for (int i = 0; i < ChunkCount; i++)
     {
         ChunkComponentData[i] = (UIntPtr)chunkGrid.Chunks[i].GetNativeArray(type).GetUnsafePtr();
     }
 }
 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);
 }
        protected override void OnUpdate()
        {
            _randomType = GetArchetypeChunkComponentType <RandomValue>(true);

            double noTagsSum    = CalcSumFromChanks(_noTagQuery);
            double firstTagSum  = CalcSumFromChanks(_firstTagQuery);
            double secondTagSum = CalcSumFromChanks(_secondTagQuery);
            double totalSum     = CalcSumFromChanks(_allRandomQuery);

            InitializeChunkIterationWorld.LogSumResults(this, noTagsSum, firstTagSum, secondTagSum, totalSum);
        }
    void CheckNeighboursAreReady()
    {
        NativeArray <ArchetypeChunk> dataChunks = meshReadyGroup.CreateArchetypeChunkArray(Allocator.TempJob);

        ArchetypeChunkEntityType entityType = GetArchetypeChunkEntityType();
        ArchetypeChunkComponentType <AdjacentSectors> adjacentType = GetArchetypeChunkComponentType <AdjacentSectors>(true);

        for (int c = 0; c < dataChunks.Length; c++)
        {
            ArchetypeChunk dataChunk = dataChunks[c];

            NativeArray <Entity>          entities  = dataChunk.GetNativeArray(entityType);
            NativeArray <AdjacentSectors> adjacents = dataChunk.GetNativeArray(adjacentType);

            for (int e = 0; e < entities.Length; e++)
            {
                Entity          entity          = entities[e];
                AdjacentSectors adjacentSquares = adjacents[e];

                NativeArray <Block> current        = new NativeArray <Block>(entityManager.GetBuffer <Block>(entity).AsNativeArray(), Allocator.TempJob);
                NativeArray <Block> northNeighbour = new NativeArray <Block>(entityManager.GetBuffer <Block>(adjacentSquares[0]).AsNativeArray(), Allocator.TempJob);
                NativeArray <Block> southNeighbour = new NativeArray <Block>(entityManager.GetBuffer <Block>(adjacentSquares[1]).AsNativeArray(), Allocator.TempJob);
                NativeArray <Block> eastNeighbour  = new NativeArray <Block>(entityManager.GetBuffer <Block>(adjacentSquares[2]).AsNativeArray(), Allocator.TempJob);
                NativeArray <Block> westNeighbour  = new NativeArray <Block>(entityManager.GetBuffer <Block>(adjacentSquares[3]).AsNativeArray(), Allocator.TempJob);
                NativeArray <Block> upNeighbour    = new NativeArray <Block>(entityManager.GetBuffer <Block>(adjacentSquares[4]).AsNativeArray(), Allocator.TempJob);
                NativeArray <Block> downNeighbour  = new NativeArray <Block>(entityManager.GetBuffer <Block>(adjacentSquares[5]).AsNativeArray(), Allocator.TempJob);

                if (northNeighbour.Length == 0 || southNeighbour.Length == 0 || eastNeighbour.Length == 0 ||
                    westNeighbour.Length == 0 || upNeighbour.Length == 0 || downNeighbour.Length == 0)
                {
                    current.Dispose();
                    northNeighbour.Dispose();
                    southNeighbour.Dispose();
                    eastNeighbour.Dispose();
                    westNeighbour.Dispose();
                    upNeighbour.Dispose();
                    downNeighbour.Dispose();
                    continue;
                }
                else
                {
                    PostUpdateCommands.AddComponent(entity, new NeighboursAreReady());
                }
                current.Dispose();
                northNeighbour.Dispose();
                southNeighbour.Dispose();
                eastNeighbour.Dispose();
                westNeighbour.Dispose();
                upNeighbour.Dispose();
                downNeighbour.Dispose();
            }
        }
        dataChunks.Dispose();
    }
示例#23
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>();
 }
示例#24
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);
 }
示例#25
0
        protected override void OnUpdate()
        {
            ArchetypeChunkComponentType <PlayerInputData> playerInputDataRW = GetArchetypeChunkComponentType <PlayerInputData>(false);

            NativeArray <ArchetypeChunk> playerInputDataChunk = playerInputDataGroup.CreateArchetypeChunkArray(Allocator.TempJob);

            if (playerInputDataChunk.Length == 0)
            {
                playerInputDataChunk.Dispose();
                return;
            }

            for (int chunkIndex = 0; chunkIndex < playerInputDataChunk.Length; chunkIndex++)
            {
                ArchetypeChunk chunk     = playerInputDataChunk[chunkIndex];
                int            dataCount = chunk.Count;

                NativeArray <PlayerInputData> playerInputDataArray = chunk.GetNativeArray(playerInputDataRW);

                for (int dataIndex = 0; dataIndex < dataCount; dataIndex++)
                {
                    PlayerInputData playerInputData = playerInputDataArray[dataIndex];

                    float moveHorizontal    = 0.0f;
                    float moveVertical      = 0.0f;
                    bool  fireButtonPressed = false;
                    switch (playerInputData.playerID)
                    {
                    case 0:
                    {
                        moveHorizontal    = Input.GetAxis("Horizontal");
                        moveVertical      = Input.GetAxis("Vertical");
                        fireButtonPressed = Input.GetButton("Fire1");
                    }
                    break;

                    default:
                    {
                        Debug.LogError("Addional players not supported for now");
                    }
                    break;
                    }

                    playerInputData.inputMovementDirection.x = moveHorizontal;
                    playerInputData.inputMovementDirection.z = moveVertical;
                    playerInputData.fireButtonPressed        = fireButtonPressed ? 1 : 0;

                    playerInputDataArray[dataIndex] = playerInputData;
                }
            }

            playerInputDataChunk.Dispose();
        }
示例#26
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);
 }
示例#27
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);
 }
示例#28
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>();
    }
示例#29
0
    protected override void OnCreate()
    {
        tankPlayerQuery         = GetEntityQuery(ComponentType.ReadWrite <TankPlayer>());
        tankPlayerComponentType = GetArchetypeChunkComponentType <TankPlayer>();

        // Create GameProgress singleton entity
        var progressEntity = EntityManager.CreateEntity();

        EntityManager.AddComponentData(progressEntity, new GameProgress
        {
            CurrentRound = 1,
        });
    }
 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);
 }