예제 #1
0
        public override void Kill(int timeLeft)
        {
            Main.PlaySound(SoundID.Shatter, projectile.Center);

            for (int k = 0; k < 5; k++)
            {
                Dust.NewDust(projectile.position, projectile.width, projectile.height, DustType <Dusts.GlassGravity>());
            }

            GlassMiniboss.SpawnShards(1, projectile.Center);
        }
        public override void AI()
        {
            if (projectile.timeLeft == 60)
            {
                origin = projectile.Center;                                                                                          //sets origin when spawned
                Projectile.NewProjectile(projectile.Center, Vector2.UnitX * 10, ProjectileType <Shockwave>(), 22, 0, Main.myPlayer); //Shockwave spawners
                Projectile.NewProjectile(projectile.Center, Vector2.UnitX * -10, ProjectileType <Shockwave>(), 22, 0, Main.myPlayer);
            }

            if (projectile.timeLeft >= 30)
            {
                float radius   = (60 - projectile.timeLeft) * 2;
                float rotation = -(60 - projectile.timeLeft) / 30f * 0.8f; //ai 0 is direction

                projectile.Center = origin - Vector2.UnitY.RotatedBy(rotation * projectile.ai[0]) * radius;
            }
            else if (projectile.timeLeft >= 1)
            {
                float rotation = -0.8f + (60 - projectile.timeLeft - 30) / 30f * ((float)Math.PI / 2 + 1.2f);

                projectile.Center = origin - Vector2.UnitY.RotatedBy(rotation * projectile.ai[0]) * 120;

                if (projectile.timeLeft == 1)
                {
                    Main.PlaySound(SoundID.Shatter, projectile.Center);
                    Main.LocalPlayer.GetModPlayer <StarlightPlayer>().Shake += 15;

                    for (int k = 0; k < 30; k++)
                    {
                        Vector2 vector = Vector2.UnitY.RotatedByRandom((float)Math.PI / 2);
                        Dust.NewDustPerfect(projectile.Center + vector * Main.rand.NextFloat(25), DustType <Dusts.Sand>(), vector * Main.rand.NextFloat(3, 5), 150, Color.White, 0.5f);
                    }

                    GlassMiniboss.SpawnShards(6, projectile.Center);
                }
            }
        }