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

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