コード例 #1
0
        public override void Kill(int timeLeft)
        {
            if (!die)
            {
                die = true;
                projectile.position = projectile.Center;
                projectile.width    = projectile.height = (radius * 16 + 8) * 2;
                projectile.Center   = projectile.position;
                projectile.hostile  = true;
                projectile.damage   = 2000;
                projectile.Damage();
            }

            Vector2 position = projectile.Center;

            for (int x = -radius; x <= (radius); x++)
            {
                for (int y = -radius; y <= (radius); y++)
                {
                    if (Math.Sqrt(x * x + y * y) <= radius)   //circle
                    {
                        int xPosition = (int)(x + position.X / 16.0f);
                        int yPosition = (int)(y + position.Y / 16.0f);
                        if (xPosition < 0 || xPosition >= Main.maxTilesX || yPosition < 0 || yPosition >= Main.maxTilesY)
                        {
                            continue;
                        }

                        Tile tile = Main.tile[xPosition, yPosition];

                        if (tile == null)
                        {
                            continue;
                        }

                        FargoGlobalTile.ClearTileWithNet(xPosition, yPosition);
                        FargoGlobalTile.ClearWallWithNet(xPosition, yPosition);
                        FargoGlobalTile.ClearLiquid(xPosition, yPosition);
                        FargoGlobalTile.SquareUpdate(xPosition, yPosition);


                        if (WorldGen.InWorld(xPosition, yPosition))
                        {
                            Main.Map.Update(xPosition, yPosition, 255);
                        }
                    }

                    //NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                }
            }

            Main.refreshMap = true;
            // Play explosion sound
            Main.PlaySound(SoundID.Item15, projectile.position);
            Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);
        }
コード例 #2
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = projectile.Center;
            int     radius   = 300; //bigger = boomer

            for (int x = -radius; x <= (radius); x++)
            {
                for (int y = -radius; y <= (radius); y++)
                {
                    if (Math.Sqrt(x * x + y * y) <= radius)   //circle
                    {
                        int  xPosition = (int)(x + position.X / 16.0f);
                        int  yPosition = (int)(y + position.Y / 16.0f);
                        Tile tile      = Main.tile[xPosition, yPosition];

                        if (tile == null)
                        {
                            continue;
                        }

                        FargoGlobalTile.ClearTileWithNet(xPosition, yPosition);
                        FargoGlobalTile.ClearWallWithNet(xPosition, yPosition);
                        FargoGlobalTile.ClearLiquid(xPosition, yPosition);
                        FargoGlobalTile.SquareUpdate(xPosition, yPosition);


                        if (WorldGen.InWorld(xPosition, yPosition))
                        {
                            Main.Map.Update(xPosition, yPosition, 255);
                        }
                    }

                    //NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                }
            }

            for (int i = 0; i < 200; i++)
            {
                NPC npc = Main.npc[i];
                if (npc.active && !npc.boss)
                {
                    npc.StrikeNPC(1000, 0, 0, true);
                }
            }

            Main.refreshMap = true;
            // Play explosion sound
            Main.PlaySound(SoundID.Item15, projectile.position);
            Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);
        }