public void Execute(int index) { float cellHeight = Cells[index].Height; float factor = ShockDataExt.DiminishingFactor(Params, deltaTime); cellHeight = (factor * cellHeight + Cells[index].AdditionalHeight).ZeroIfSmall(); Cells[index] = ShockwaveData.Create( Cells[index].Position, cellHeight, Cells[index].WaveTime ); }
public static JobHandle Begin( NativeArray <ShockwaveData> cells, ShockMasterParams master, JobHandle dependency ) { var job = new ShockwaveSuperpositionJob() { Cells = cells, Params = master, deltaTime = Time.deltaTime }; return(IJobParallelForExtensions.Schedule( job, cells.Length, ShockDataExt.GetInnerLoopCountFromSize(master), dependency )); }
public static JobHandle Begin( ShockwaveData centre, ShockMasterParams masterParams, NativeArray <ShockwaveData> cells, JobHandle dependency ) { ShockwaveSimJob job = new ShockwaveSimJob() { Cells = cells, Centre = centre, Params = masterParams }; return(IJobParallelForExtensions.Schedule( job, cells.Length, ShockDataExt.GetInnerLoopCountFromSize(masterParams), dependency )); }
private void ProcessWithCentre(int index) { float2 cellPos = Cells[index].Position; float distance = ShockDataExt.Distance(cellPos, Centre.Position); float additionalHeight = Cells[index].AdditionalHeight; if (distance < Params.InfluenceRadius) { additionalHeight = (Centre.Height / (1 + distance)).ZeroIfSmall(); } Cells[index] = new ShockwaveData() { Position = cellPos, Height = Cells[index].Height, WaveTime = Cells[index].WaveTime, CentreIndex = Cells[index].CentreIndex, AdditionalHeight = additionalHeight }; }