/// <summary> /// /// </summary> /// <param name="world"></param> /// <param name="args">args[0] = center location, args[1] = explosion intensity, args[2] = Entity ent</param> /// <returns></returns> public Entity[] BuildEntityGroup(EntityWorld world, params object[] args) { Vector2 center = (Vector2)args[0]; int intensity = (int)args[1]; Entity ent = (Entity)args[2]; Vector2 velocity = (Vector2)args[3]; world.CreateEntityGroup("BigExplosion", "Explosions", center, 15, ent, velocity); double max = Math.PI * 2; double step = (Math.PI * 2) / intensity; for (double angle = 0; angle < max; angle += step) { float radius = 75; radius = ConvertUnits.ToSimUnits(radius); Vector2 offset = new Vector2(radius * (float)Math.Cos(angle), radius * (float)Math.Sin(angle)); offset.Normalize(); offset *= radius; world.CreateEntityGroup("BigExplosion", "Explosions", center + offset, 15, ent, velocity); } return explosions.ToArray(); }
public static Action<Entity> BigEnemyDeath(Entity e, EntityWorld _World, int points) { return ent => { Vector2 poss = e.GetComponent<ITransform>().Position; _World.CreateEntityGroup("BigExplosion", "Explosions", poss, 10, ent, e.GetComponent<IVelocity>().LinearVelocity); int splodeSound = rbitch.Next(1, 5); SoundManager.Play("Explosion" + splodeSound.ToString()); if (ent is Entity && (ent as Entity).Group != null && ((ent as Entity).Group == "Players" || (ent as Entity).Group == "Structures") && e.HasComponent<Crystal>()) { _World.CreateEntity("Crystal", e.GetComponent<ITransform>().Position, e.GetComponent<Crystal>().Color, e.GetComponent<Crystal>().Amount, e); ScoreSystem.GivePoints(points); _World.CreateEntity("Score", points.ToString(), poss).Refresh(); } }; }