Ejemplo n.º 1
0
        public static Action<Entity> BossDeath(int type, SpaceWorld _World, Entity e, Sprite s, int tier, int points, string bossName)
        {
            return blarg =>
            {
                Vector2 poss = e.GetComponent<ITransform>().Position;

                if (type < 6)
                    _World.CreateEntityGroup("BigExplosion", "Explosions", poss, 15, blarg, e.GetComponent<IVelocity>().LinearVelocity);
                else
                {
                    _World.CreateEntityGroup("BiggerExplosion", "Explosions", poss, 7, blarg, e.GetComponent<IVelocity>().LinearVelocity);
                }

                int splodeSound = rbitch.Next(1, 5);
                SoundManager.Play("Explosion" + splodeSound.ToString());

                if (blarg is Entity && (blarg as Entity).Group != null && ((blarg as Entity).Group == "Players" || (blarg as Entity).Group == "Structures"))
                {
                    for (int m = 0; m < (_World as SpaceWorld).Players; ++m)
                    {
                        Entity ent = (_World as SpaceWorld).Player.ToArray()[m];
                        for (int cry = 0; cry < 5; ++cry)
                        {
                            Color crystalColor = DirectorSystem.CrystalColor();
                            int amount = 20 * tier;
                            Vector2 p = e.GetComponent<ITransform>().Position;
                            float range = (float)Math.Sqrt(s.CurrentRectangle.Width * s.CurrentRectangle.Height);
                            float x = 2 * (float)rbitch.NextDouble() - 1;
                            float y = 2 * (float)rbitch.NextDouble() - 1;
                            Vector2 offs = ConvertUnits.ToSimUnits(new Vector2(x, y) * range);
                            p += offs;

                            (_World as SpaceWorld).enemySpawnSystem.SpawnCrystal(p, crystalColor, amount, m);
                        }
                    }
                }

                if (blarg != null && blarg.Tag != "Base")
                {
                    ScoreSystem.GivePoints(points);
                    _World.CreateEntity("Score", points.ToString(), poss).Refresh();
                    BossScreen.BossKilled(bossName);
                }

                _World.enemySpawnSystem.ResetTags();
                _World.enemySpawnSystem.SpawnRate = 1;
            };
        }
Ejemplo n.º 2
0
        public static Action<Entity> SmallEnemyDeath(Entity e, SpaceWorld _World, int points)
        {
            return ent =>
            {
                Vector2 poss = e.GetComponent<ITransform>().Position;
                _World.CreateEntity("Explosion", 0.5f, poss, ent, 3, e.GetComponent<IVelocity>().LinearVelocity).Refresh();

                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);
                    if (points != 0)
                    {
                        ScoreSystem.GivePoints(points);
                        _World.CreateEntity("Score", points.ToString(), poss).Refresh();
                    }
                }
            };
        }