protected override JobHandle OnUpdate(JobHandle inputDeps) { currentCooldown -= Time.deltaTime; var job = new PositionJob { CDPercentage = currentCooldown / totalCooldown }; if (currentCooldown <= 0) { currentCooldown = totalCooldown; //NativeArray<Entity> allEntities = EntityManager.GetAllEntities(Allocator.TempJob); int step = (int)MicrobeSpawner.total / 500; for (int i = 0; i < MicrobeSpawner.total; i += step) { //Entity e = EntityManager.CreateEntity(EnemySpawner._cellArchetype); Debug.LogError("there is " + MicrobeSpawner.total + " and index is " + i); MicrobeSpawner.SpawnEntity( EntityManager.GetComponentData <Position>(MicrobeSpawner.entityArray[i]).Value + MicrobeSpawner.ReturnRandomPositionOffset(1f), MicrobeSpawner.EntityType.Antibody); //if (EntityManager.HasComponent<MitosisData>(e)) //{ // EntityManager.SetComponentData(e, new Position() {Value = EntityManager.GetComponentData<Position>(allEntities[i]).Value}); //} } } return(job.Schedule(this, inputDeps)); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var job = new PositionJob() { dt = Time.deltaTime }; return(job.Schedule(this, inputDeps)); }
private void Update() { var positionJob = new PositionJob { deltaTime = Time.deltaTime, endPositions = this.endPositions }; positionJobHandle = positionJob.Schedule(transformAccessArray); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var job = new PositionJob() { m_charaMove = m_group.GetComponentDataArray <CharaMove>(), }; inputDeps = job.Schedule(inputDeps); inputDeps.Complete(); return(inputDeps); // return job.Schedule(this, 64, inputDeps); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var positionArchetypeChunkComponentType = GetArchetypeChunkComponentType <PositionComponent>(true); var faceArchetypeChunkComponentType = GetArchetypeChunkComponentType <FaceComponent>(true); var localToWorldArchetypeChunkComponentType = GetArchetypeChunkComponentType <LocalToWorldComponent>(false); var jobHandle = new PositionJob() { LastSystemVersion = this.LastSystemVersion, PositionArch = positionArchetypeChunkComponentType, FaceArch = faceArchetypeChunkComponentType, LocalToWorldArch = localToWorldArchetypeChunkComponentType, }.Schedule(_updateQuery, inputDeps); return(jobHandle); }
public async Task <IActionResult> Create(PositionCreateViewModel model) { if (ModelState.IsValid) { var position = new PositionJob() { Id = model.Id, PositionJobCode = model.PositionJobCode, PositionJobName = model.PositionJobName, InsuranceMoney = model.InsuranceMoney, Status = true }; await _positionService.CreateAsync(position); return(RedirectToAction(nameof(Index))); } return(View()); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var g = UseEcsManager.Instance.Ground; for (int x = 0; x < 50; x++) { for (int z = 0; z < 50; z++) { hm[x + z * 50] = g.SampleHeight(new Vector3(x * 2 - 50, 0, z * 2 - 50)); } } var job = new PositionJob() { HeightMap = hm, Time = Time.time, dt = Time.deltaTime }; return(job.Schedule(this, 1024, inputDeps)); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { NativeArray <CharaPos> charaPoses = m_query.ToComponentDataArray <CharaPos>(Allocator.TempJob); NativeArray <CharaDelta> charaDeltas = m_query.ToComponentDataArray <CharaDelta>(Allocator.TempJob); var job = new PositionJob() { m_charaPoses = charaPoses, m_charaDeltas = charaDeltas, }; inputDeps = job.Schedule(inputDeps); inputDeps.Complete(); m_query.CopyFromComponentDataArray(job.m_charaPoses); charaPoses.Dispose(); charaDeltas.Dispose(); return(inputDeps); }
protected override JobHandle OnUpdate(JobHandle handle) { CollisionJob fJob = new CollisionJob { colliderVel = colliderGroup.colVel, colliderPos = colliderGroup.colPos, colliderInfo = colliderGroup.colInfo, colliderID = colliderGroup.colID, }; handle = fJob.Schedule(colliderGroup.Length, 1, handle); PositionJob posJob = new PositionJob { objectPos = positionGroup.objPos, objectVel = positionGroup.objVel, }; return(posJob.Schedule(positionGroup.Length, 1, handle)); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { // reset values to -1 var clearArrayJob = new MemsetNativeArray <int> // MemsetNativeArray job assigns the same value to the whole array { Source = gridIndexArray, Value = -1 }; var clearArrayJobHandle = clearArrayJob.Schedule(ARRAY_SIZE, 64, inputDeps); // not sure what the 64 innerloop batch count means // fill index array job var fillJob = new FillDataArrayJob() { gridIndexData = gridIndexArray }; var fillJobHandle = fillJob.Schedule(this, clearArrayJobHandle); // makes sure the clearArrayJob is complete #region legacy slow /* * entities = MicrobeSpawner.entityArray; * centerPos = Object.FindObjectOfType<InputComponent>().transform.position; * globalOffset += .2f; // WTF IS THIS * * // update avoidance data and calculate force * * // THIS MAKES THE SYSTEM SLOW!!! * * for (int i = 0; i < MicrobeSpawner.total; i++) * { * MovementData indexForcePrevPos = EntityManager.GetComponentData<MovementData>(entities[i]); * Position position = EntityManager.GetComponentData<Position>(entities[i]); * entityPositionsArray[i] = position.Value; * * // remove old position from grid * int outerIndex = CoordsToOuterIndex( * (int)indexForcePrevPos.PreviousPosition.x, * (int)indexForcePrevPos.PreviousPosition.y); * * if (outerIndex >= 0 && outerIndex < gridIndexArray.Length) * { * for (int innerIndex = outerIndex; innerIndex < outerIndex + COLLISION_FORCES_PER_TILE; innerIndex++) * { * if (gridIndexArray[innerIndex] == indexForcePrevPos.Index) * { * gridIndexArray[innerIndex] = 0; * } * } * } * * // add new position to grid * outerIndex = CoordsToOuterIndex((int)position.Value.x, (int)position.Value.z); * if (outerIndex >= 0 && outerIndex < gridIndexArray.Length) * { * for (int innerIndex = outerIndex; innerIndex < outerIndex + COLLISION_FORCES_PER_TILE; innerIndex++) * { * if (gridIndexArray[innerIndex] == 0) * { * gridIndexArray[innerIndex] = indexForcePrevPos.Index; * } * } * } * }*/ #endregion // movement job var movementJob = new PositionJob(gridIndexArray, entityPositionsArray); var movementJobHandle = movementJob.Schedule(this, fillJobHandle); // makes sure the fillJob is complete return(movementJobHandle); //return movementJob.Schedule(this, inputDeps); }