public static ExplosionPropagationLine Getline() { if (PooledThis.Count > 0) { ExplosionPropagationLine line = PooledThis[0]; PooledThis.RemoveAt(0); return(line); } else { return(new ExplosionPropagationLine()); } }
public static void StartExplosion(Vector3Int MatrixPOS, float strength, Matrix matrix) { int Radius = (int)Math.Round(strength / (Math.PI * 75)); if (Radius > 150) { Radius = 150; } byte ShakingStrength = 25; if (strength > 800) { ShakingStrength = 75; } else if (strength > 8000) { ShakingStrength = 125; } else if (strength > 80000) { ShakingStrength = 255; } ExplosionUtils.PlaySoundAndShake(MatrixManager.LocalToWorld(MatrixPOS, matrix).RoundToInt(), ShakingStrength, Radius / 20); //Generates the conference var explosionData = new ExplosionData(); circleBres(explosionData, MatrixPOS.x, MatrixPOS.y, Radius); float InitialStrength = strength / explosionData.CircleCircumference.Count; foreach (var ToPoint in explosionData.CircleCircumference) { var Line = ExplosionPropagationLine.Getline(); Line.SetUp(MatrixPOS.x, MatrixPOS.y, ToPoint.x, ToPoint.y, InitialStrength, matrix); Line.Step(); } }