private void ConfigureShockwave() { var pos = _Transform.position; _Shockwave = ShockwaveData.Create( new float2(pos.x, pos.z), 0 ); }
private void UpdateCentre(int index) { Cells[index] = new ShockwaveData() { Position = Centre.Position, WaveTime = Centre.WaveTime, Height = Cells[index].Height, AdditionalHeight = Centre.Height, CentreIndex = Centre.CentreIndex }; }
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 void OnPressMakeRandomShockwaveCentre() { if (_Controller != null) { (float width, float depth) = _Controller.GetSize(); float x = Random.Range(0f, width); float y = Random.Range(0f, depth); ShockwaveData centre = ShockwaveData.Create( x, y, _Controller.GetHeightFactor(), 0 ); _Controller.InjectShockwave(centre); } }
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 }; }
public static (float2 position, float height, float angle) ToParts( this ShockwaveData value ) => (value.Position, value.Height, value.Angle);