private void ConfigureShockwave()
        {
            var pos = _Transform.position;

            _Shockwave = ShockwaveData.Create(
                new float2(pos.x, pos.z),
                0
                );
        }
Esempio n. 2
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
     };
 }
Esempio n. 3
0
        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
                );
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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
                       ));
        }
Esempio n. 6
0
        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
            };
        }
Esempio n. 7
0
 public static (float2 position, float height, float angle) ToParts(
     this ShockwaveData value
     ) => (value.Position, value.Height, value.Angle);