public override void UpdateBeforeSimulation() { base.UpdateBeforeSimulation(); int count = this.m_creationBuffer.Count; if (count > 20) { count /= 10; } while (true) { count--; if (count <= 0) { return; } DebrisCreationInfo info = this.m_creationBuffer.Dequeue(); DebrisType type = info.Type; if (type == DebrisType.Voxel) { (this.CreateVoxelDebris(50f, info.Ammount).Debris as MyDebrisVoxel.MyDebrisVoxelLogic).Start(info.Position, info.Velocity, info.Material); continue; } if (type != DebrisType.Random) { throw new ArgumentOutOfRangeException(); } MyDebrisBase base2 = this.CreateRandomDebris(); if (base2 != null) { base2.Debris.Start(info.Position, info.Velocity); } } }
void SpawnDebris(DebrisType debrisType) { if (debrisType == DebrisType.Expired) { for (int i = 0; i < 10; i++) { Vector2 velocity = Main.rand.NextVector2CircularEdge(1, 1) * 2; float scale = 1.2f * Magnitude; Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType <LifeOrbDebris>(), velocity.X, velocity.Y, Scale: scale); } } else if (debrisType == DebrisType.Tile) { for (int i = 0; i < 10; i++) { float minAngle = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - 0.4f; float maxAngle = minAngle + 0.8f; Vector2 velocity = Main.rand.NextVector2Unit(minAngle, maxAngle) * 1.2f; float scale = 1.2f * Magnitude; Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType <LifeOrbDebris>(), velocity.X, velocity.Y, Scale: scale); } } else if (debrisType == DebrisType.Entity) { for (int i = 0; i < 5; i++) { float minAngle = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - 0.2f; float maxAngle = minAngle + 0.4f; Vector2 velocity = Main.rand.NextVector2Unit(minAngle, maxAngle) * 0.7f; float scale = 0.7f * Magnitude; Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType <LifeOrbDebris>(), velocity.X, velocity.Y, Scale: scale); } } }