コード例 #1
0
        public override void Kill(int timeLeft)
        {
            SpiritMod.tremorTime = (int)(charge * 0.66f);
            Main.PlaySound(SoundID.Item70, projectile.Center);
            for (double i = 0; i < 6.28; i += Main.rand.NextFloat(1f, 2f))
            {
                int lightningproj = Projectile.NewProjectile(projectile.Center + projectile.velocity - (new Vector2((float)Math.Sin(i), (float)Math.Cos(i)) * 5f), new Vector2((float)Math.Sin(i), (float)Math.Cos(i)) * 2.5f, ModContent.ProjectileType <MarkOfZeusProj3>(), projectile.damage, projectile.knockBack, projectile.owner, charge);
                Main.projectile[lightningproj].timeLeft = (int)(30 * Math.Sqrt(charge));
            }
            for (double i = 0; i < 6.28; i += 0.15)
            {
                Dust dust  = Dust.NewDustPerfect(projectile.Center + projectile.velocity, 133, new Vector2((float)Math.Sin(i) * Main.rand.NextFloat(3f) * (float)(Math.Sqrt(charge) / 3), (float)Math.Cos(i)) * Main.rand.NextFloat(4f) * (float)(Math.Sqrt(charge) / 3));
                Dust dust2 = Dust.NewDustPerfect(projectile.Center + projectile.velocity, 133, new Vector2((float)Math.Sin(i) * Main.rand.NextFloat(1.8f) * (float)(Math.Sqrt(charge) / 3), (float)Math.Cos(i)) * Main.rand.NextFloat(2.4f) * (float)(Math.Sqrt(charge) / 3));
                dust.noGravity  = true;
                dust2.noGravity = true;
                dust.scale      = 0.75f;
                dust2.scale     = 0.75f;
            }
            for (int j = 0; j < 13; j++)
            {
                Vector2 vel = Vector2.Zero - projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)) * 0.25f;

                StarParticle particle = new StarParticle(
                    projectile.Center + Main.rand.NextVector2Circular(10, 10) + projectile.velocity,
                    Main.rand.NextVector2Circular(7, 5),
                    Color.Gold,
                    Main.rand.NextFloat(0.1f, 0.2f),
                    Main.rand.Next(30, 60));
                ParticleHandler.SpawnParticle(particle);
            }
        }
コード例 #2
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            for (int i = 0; i < 8; i++)
            {
                Vector2 vel = Vector2.Zero - projectile.velocity;
                vel.Normalize();
                vel  = vel.RotatedBy(Main.rand.NextFloat(-0.5f, 0.5f));
                vel *= Main.rand.NextFloat(2, 5);
                ImpactLine line = new ImpactLine(target.Center - (vel * 10), vel, new Color(48, 255, 176), new Vector2(0.25f, Main.rand.NextFloat(0.75f, 1.75f)), 70);
                line.TimeActive = 30;
                ParticleHandler.SpawnParticle(line);
            }

            for (int j = 0; j < 7; j++)
            {
                Vector2 vel      = Vector2.Zero - projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)) * 0.25f;
                int     timeLeft = Main.rand.Next(40, 100);

                StarParticle particle = new StarParticle(
                    projectile.Center + Main.rand.NextVector2Circular(10, 10) - (vel * 5),
                    vel + Main.rand.NextVector2Circular(3, 3),
                    new Color(48, 255, 176),
                    Main.rand.NextFloat(0.1f, 0.2f),
                    timeLeft);
                particle.TimeActive = (uint)(timeLeft / 2);
                ParticleHandler.SpawnParticle(particle);
            }

            if (!target.GetGlobalNPC <ArtemisGNPC>().artemisMarked)
            {
                Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType <ArtemisCrescent>(), 0, 0, projectile.owner, target.whoAmI);
            }
            target.GetGlobalNPC <ArtemisGNPC>().artemisMarked = true;
            target.GetGlobalNPC <ArtemisGNPC>().artemisTicker = 180;
        }
コード例 #3
0
        public override bool PreAI()
        {
            if (Main.rand.Next(3) == 1)
            {
                StarParticle particle = new StarParticle(
                    projectile.Center + Main.rand.NextVector2Circular(5, 5),
                    projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)) * 0.1f,
                    Main.rand.NextBool() ? new Color(125, 255, 253) : new Color(48, 255, 176),
                    Main.rand.NextFloat(0.05f, 0.15f),
                    Main.rand.Next(20, 40));

                ParticleHandler.SpawnParticle(particle);
            }

            var target = Main.npc.Where(n => n.active && Vector2.Distance(n.Center, projectile.Center) < 200 && n.GetGlobalNPC <ArtemisGNPC>().artemisMarked).OrderBy(n => Vector2.Distance(n.Center, projectile.Center)).FirstOrDefault();

            if (target != default)
            {
                Vector2 direction = target.Center - projectile.Center;
                direction.Normalize();
                direction          *= 10;
                projectile.velocity = Vector2.Lerp(projectile.velocity, direction, 0.05f);
            }
            Lighting.AddLight(projectile.Center, new Color(48, 255, 176).ToVector3() * 0.3f);
            return(true);
        }
コード例 #4
0
        //public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        //{
        //    Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f);
        //    for (int k = 0; k < projectile.oldPos.Length; k++)
        //    {
        //        Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY);
        //        Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length);
        //        spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f);
        //    }
        //    return true;
        //}

        public override void AI()
        {
            if (!initialized)
            {
                initialized = true;
                if (Main.netMode != NetmodeID.Server)
                {
                    trail = new MarkOfZeusPrimTrailTwo(projectile, 2f * (float)(Math.Sqrt(charge) / 5));
                    SpiritMod.primitives.CreateTrail(trail);
                }
            }
            trail?.AddPoints();
            if (Main.rand.Next(3) == 0)
            {
                int          timeLeft = Main.rand.Next(40, 100);
                StarParticle particle = new StarParticle(
                    projectile.Center,
                    projectile.velocity.RotatedBy(Main.rand.NextFloat(-1.57f, 1.57f)) * 0.3f,
                    Color.Gold,
                    Main.rand.NextFloat(0.1f, 0.2f),
                    timeLeft);
                particle.TimeActive = (uint)(timeLeft / 2);
                ParticleHandler.SpawnParticle(particle);
            }
        }
コード例 #5
0
        public override void AI()
        {
            Lighting.AddLight(npc.Center, Color.Green.ToVector3() * 0.3f);

            frameCounter++;
            if (frameCounter % 7 == 0)
            {
                frameY++;
            }
            frameY %= 7;

            bloomCounter += 0.04f;

            projectileCounter++;
            if (projectileCounter % 160 == 0)
            {
                //First, check if there's a potential damaged target to heal nearby
                bool targetNearby = false;
                for (int i = 0; i < Main.npc.Length; i++)
                {
                    NPC n = Main.npc[i];
                    if (n.CanBeChasedBy(this) && n.active && n.Distance(npc.Center) < AsclepiusBoonOrb.HOME_DISTANCE && n.life < n.lifeMax && n.whoAmI != npc.whoAmI)
                    {
                        targetNearby = true;
                    }
                }

                //If there is, proceed and do visual effects
                if (targetNearby)
                {
                    if (!Main.dedServ)
                    {
                        for (int i = 0; i < 15; i++)
                        {
                            Vector2      direction = Main.rand.NextVector2Circular(20, 20);
                            StarParticle particle  = new StarParticle(
                                (npc.Center - new Vector2(0, 40)) + direction,
                                direction * 0.15f,
                                new Color(49, 212, 76),
                                Main.rand.NextFloat(0.08f, 0.23f),
                                Main.rand.Next(20, 40));

                            ParticleHandler.SpawnParticle(particle);
                        }
                        Main.PlaySound(SoundID.DD2_DarkMageCastHeal, npc.Center);
                    }

                    for (int i = 0; i < 3; i++)
                    {
                        int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 40, ModContent.NPCType <AsclepiusBoonOrb>(), 0, npc.whoAmI, i * 2.08f);
                        if (Main.netMode != NetmodeID.SinglePlayer)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }
                }
            }
        }
コード例 #6
0
ファイル: UiNote.cs プロジェクト: ST3ALth/Play
    public void CreatePerfectNoteEffect()
    {
        int targetStarCount = Mathf.Max(6, (int)rectTransform.rect.width / 20);

        for (int i = 0; i < targetStarCount; i++)
        {
            StarParticle star = CreatePerfectStar();
            // Change parent, because this note will be destoyed soon.
            star.transform.SetParent(transform.parent);
        }
    }
コード例 #7
0
        public override void AI()
        {
            Player player = Main.player[(int)npc.ai[0]];

            returnCounter++;
            if (returnCounter == 200)
            {
                if (Explode())
                {
                    npc.active = false;
                }
                else
                {
                    shrinking = true;
                }
            }
            npc.velocity *= 0.97f;
            npc.rotation += 0.03f;
            Lighting.AddLight(npc.Center, Color.Cyan.R * 0.005f, Color.Cyan.G * 0.005f, Color.Cyan.B * 0.005f);
            npc.ai[1]++;
            if (npc.ai[1] == 20)
            {
                Main.PlaySound(SoundID.DD2_EtherianPortalIdleLoop, npc.Center);
            }
            if (shrinking)
            {
                shrinkCounter += 0.1f;
                npc.scale      = 0.75f + (float)(Math.Sin(shrinkCounter));
                if (npc.scale < 0.3f)
                {
                    npc.active = false;
                    for (int j = 0; j < 14; j++)
                    {
                        int timeLeft = Main.rand.Next(20, 40);

                        StarParticle particle = new StarParticle(
                            npc.Center,
                            Main.rand.NextVector2Circular(10, 7),
                            Color.Cyan,
                            Main.rand.NextFloat(0.15f, 0.3f),
                            timeLeft);
                        ParticleHandler.SpawnParticle(particle);
                    }
                }
                else if (npc.scale > 1)
                {
                    npc.scale = ((npc.scale - 1) / 2f) + 1;
                }
            }
            else
            {
                npc.scale = MathHelper.Min(npc.ai[1] / 15f, 1);
            }
        }
コード例 #8
0
ファイル: PlayerCrownDisplayer.cs プロジェクト: matfrem/Play
    private void CreateCrownChangeEffect()
    {
        if (crownChangePrefab != null)
        {
            StarParticle star = Instantiate(crownChangePrefab);

            star.transform.SetParent(transform);
            RectTransform starRectTransform = star.GetComponent <RectTransform>();
            starRectTransform.localPosition = Vector3.zero;
            LeanTween.scale(star.RectTransform, Vector3.zero, 1f)
            .setOnComplete(() => Destroy(star.gameObject));
        }
    }
コード例 #9
0
        public static void MakeStar(float scale, Vector2 center)
        {
            Color color = AuroraColor;

            color.A = (byte)Main.rand.Next(100, 150);
            StarParticle particle = new StarParticle(
                center + Main.rand.NextVector2Circular(30, 30),
                Main.rand.NextVector2Unit() * Main.rand.NextFloat(1.5f, 3f),
                color,
                scale,
                Main.rand.Next(60, 120));

            ParticleHandler.SpawnParticle(particle);
        }
コード例 #10
0
ファイル: SentenceDisplayer.cs プロジェクト: bmwalters/Play
    private void CreatePerfectSentenceStar()
    {
        StarParticle  star = Instantiate(perfectSentenceStarPrefab, uiEffectsContainer);
        RectTransform starRectTransform = star.GetComponent <RectTransform>();
        float         anchorX           = UnityEngine.Random.Range(0f, 1f);
        float         anchorY           = UnityEngine.Random.Range(0f, 1f);

        starRectTransform.anchorMin        = new Vector2(anchorX, anchorY);
        starRectTransform.anchorMax        = new Vector2(anchorX, anchorY);
        starRectTransform.anchoredPosition = Vector2.zero;

        star.RectTransform.localScale = Vector3.one * UnityEngine.Random.Range(0.2f, 0.6f);
        LeanTween.scale(star.RectTransform, Vector3.zero, 1f)
        .setOnComplete(() => Destroy(star.gameObject));
    }
コード例 #11
0
ファイル: ParticleField.cs プロジェクト: Dytonis/LudumDare40
    public void Start()
    {
        center = Camera.main.transform;

        for (int i = 0; i < count; i++)
        {
            StarParticle part = Instantiate(prefab) as StarParticle;
            part.transform.SetParent(transform);
            part.gameObject.hideFlags = HideFlags.HideInHierarchy;
            part.center               = center;
            part.velocity             = new Vector3(Random.Range(-velocityRandomness, velocityRandomness), 0, Random.Range(-velocityRandomness, velocityRandomness));
            part.transform.position   = new Vector3(Random.Range(-300, 300), -10, Random.Range(-300, 300));
            part.transform.localScale = new Vector3(Random.Range(scaleRange.x, scaleRange.y), 1, Random.Range(scaleRange.x, scaleRange.y));
        }
    }
コード例 #12
0
ファイル: UiNote.cs プロジェクト: ST3ALth/Play
    private void CreateGoldenStar()
    {
        StarParticle star = Instantiate(goldenStarPrefab);

        star.transform.SetParent(transform);
        RectTransform starRectTransform = star.GetComponent <RectTransform>();
        float         anchorX           = Random.Range(0f, 1f);
        float         anchorY           = Random.Range(0f, 1f);

        starRectTransform.anchorMin        = new Vector2(anchorX, anchorY);
        starRectTransform.anchorMax        = new Vector2(anchorX, anchorY);
        starRectTransform.anchoredPosition = Vector2.zero;
        star.Init();
        star.StartScale = Random.Range(0, 0.5f);
    }
コード例 #13
0
    private void CreatePerfectSentenceStar()
    {
        StarParticle star = Instantiate(perfectSentenceStarPrefab);

        star.transform.SetParent(transform);
        RectTransform starRectTransform = star.GetComponent <RectTransform>();
        float         anchorX           = UnityEngine.Random.Range(0f, 1f);
        float         anchorY           = UnityEngine.Random.Range(0f, 1f);

        starRectTransform.anchorMin        = new Vector2(anchorX, anchorY);
        starRectTransform.anchorMax        = new Vector2(anchorX, anchorY);
        starRectTransform.anchoredPosition = Vector2.zero;

        star.Init();
        star.TargetLifetimeInSeconds = 1f;
        star.StartScale  = UnityEngine.Random.Range(0.2f, 0.6f);
        star.TargetScale = 0;
    }
コード例 #14
0
        public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
        {
            if (Slam)
            {
                crit = true;
            }
            if (Collision.CheckAABBvAABBCollision(target.position, target.Size, projectile.position, projectile.Size))
            {
                damage = (int)(damage * 1.5f);
                for (int i = 0; i < 8; i++)
                {
                    Vector2 vel = Main.rand.NextFloat(6.28f).ToRotationVector2();
                    vel *= Main.rand.NextFloat(2, 5);
                    ImpactLine line = new ImpactLine(target.Center - (vel * 10), vel, Color.Green, new Vector2(0.25f, Main.rand.NextFloat(0.75f, 1.75f) * 1.5f), 70);
                    line.TimeActive = 30;
                    ParticleHandler.SpawnParticle(line);
                }
                float progress = Timer / SwingTime;                 //How far the projectile is through its swing
                if (Slam)
                {
                    progress = EaseFunction.EaseCubicInOut.Ease(progress);
                }

                if (Slam && progress > 0.4f && progress < 0.6f)
                {
                    if (Owner.GetModPlayer <MyPlayer>().Shake < 5)
                    {
                        Owner.GetModPlayer <MyPlayer>().Shake += 5;
                    }
                    for (int j = 0; j < 14; j++)
                    {
                        int timeLeft = Main.rand.Next(20, 40);

                        StarParticle particle = new StarParticle(
                            target.Center,
                            Main.rand.NextVector2Circular(10, 7),
                            Color.Lerp(new Color(106, 255, 35), new Color(18, 163, 85), Main.rand.NextFloat()),
                            Main.rand.NextFloat(0.15f, 0.3f),
                            timeLeft);
                        ParticleHandler.SpawnParticle(particle);
                    }
                }
            }
        }
コード例 #15
0
        private void ThrowOutAI()
        {
            projectile.rotation = projectile.AngleFrom(Owner.Center);
            Vector2 position = Owner.MountedCenter;
            float   progress = ++Timer / SwingTime;           //How far the projectile is through its swing

            if (Slam)
            {
                slamTimer++;
                progress = EaseFunction.EaseCubicInOut.Ease(progress);
                if (progress > 0.15f && progress < 0.85f)
                {
                    Vector2 vel      = Vector2.Zero;
                    int     timeLeft = Main.rand.Next(40, 100);

                    StarParticle particle = new StarParticle(
                        CurrentBase,
                        Main.rand.NextVector2Circular(1, 1),
                        Color.Lerp(new Color(106, 255, 35), new Color(18, 163, 85), Main.rand.NextFloat()),
                        Main.rand.NextFloat(0.1f, 0.2f),
                        timeLeft);
                    particle.TimeActive = (uint)(timeLeft / 2);
                    ParticleHandler.SpawnParticle(particle);
                }
            }
            else
            {
                progress = EaseFunction.EaseQuadOut.Ease(progress);
            }

            if (slamTimer == 5)
            {
                Main.PlaySound(SoundID.NPCDeath7, projectile.Center);
            }

            projectile.Center    = position + GetSwingPosition(progress);
            projectile.direction = projectile.spriteDirection = -Owner.direction * (Flip ? -1 : 1);

            if (Timer >= SwingTime)
            {
                projectile.Kill();
            }
        }
コード例 #16
0
ファイル: UiNote.cs プロジェクト: ST3ALth/Play
    private StarParticle CreatePerfectStar()
    {
        StarParticle star = Instantiate(perfectStarPrefab);

        star.transform.SetParent(transform);
        RectTransform starRectTransform = star.GetComponent <RectTransform>();
        float         anchorX           = Random.Range(0f, 1f);
        float         anchorY           = Random.Range(0f, 1f);

        starRectTransform.anchorMin        = new Vector2(anchorX, anchorY);
        starRectTransform.anchorMax        = new Vector2(anchorX, anchorY);
        starRectTransform.anchoredPosition = Vector2.zero;

        star.Init();
        star.TargetLifetimeInSeconds = 1f;
        star.StartScale  = Random.Range(0.5f, 0.8f);
        star.TargetScale = 0;

        return(star);
    }
コード例 #17
0
    private void CreatePerfectStar()
    {
        StarParticle star = Instantiate(perfectStarPrefab);

        star.transform.SetParent(transform);
        RectTransform starRectTransform = star.GetComponent <RectTransform>();
        float         anchorX           = 1;
        float         anchorY           = 0.9f;

        starRectTransform.anchorMin        = new Vector2(anchorX, anchorY);
        starRectTransform.anchorMax        = new Vector2(anchorX, anchorY);
        starRectTransform.anchoredPosition = Vector2.zero;
        starRectTransform.localEulerAngles = new Vector3(0, 0, Random.Range(0, 180));

        star.RectTransform.localScale = Vector3.one * 1f;
        LeanTween.scale(star.RectTransform, Vector3.zero, 1f)
        .setOnComplete(() => Destroy(star.gameObject));

        // Move to another parent to ensure that it is drawn in front of the notes.
        star.transform.SetParent(uiEffectsContainer);
    }
コード例 #18
0
    private void CreateGoldenStar()
    {
        StarParticle star = Instantiate(goldenStarPrefab);

        star.transform.SetParent(rectTransform);
        RectTransform starRectTransform = star.GetComponent <RectTransform>();
        float         anchorX           = Random.Range(0f, 1f);
        float         anchorY           = Random.Range(0f, 1f);

        starRectTransform.anchorMin        = new Vector2(anchorX, anchorY);
        starRectTransform.anchorMax        = new Vector2(anchorX, anchorY);
        starRectTransform.anchoredPosition = Vector2.zero;

        star.RectTransform.localScale = Vector3.one * Random.Range(0, 0.5f);
        LeanTween.scale(star.RectTransform, Vector3.one * Random.Range(0.5f, 1f), Random.Range(1f, 2f))
        .setOnComplete(() => Destroy(star.gameObject));

        // Move to another parent to ensure that it is drawn in front of the notes.
        star.transform.SetParent(uiEffectsContainer);

        stars.Add(star);
    }
コード例 #19
0
        public override void HitEffect(int hitDirection, double damage)
        {
            if (Main.dedServ)
            {
                return;
            }

            Main.PlaySound(SoundID.Item27.WithPitchVariance(0.3f).WithVolume(0.6f), npc.Center);
            for (int i = 0; i < 15; i++)
            {
                Vector2      direction = Main.rand.NextVector2Circular(20, 20);
                StarParticle particle  = new StarParticle(
                    npc.Center + direction,
                    direction * 0.15f,
                    new Color(49, 212, 76),
                    Main.rand.NextFloat(0.08f, 0.23f),
                    Main.rand.Next(20, 40));
                Main.PlaySound(SoundID.NPCHit, (int)npc.position.X, (int)npc.position.Y, 3);

                ParticleHandler.SpawnParticle(particle);
            }
        }
コード例 #20
0
        public override void AI()
        {
            if (noiseRotation < 0.02f)
            {
                noiseRotation = Main.rand.NextFloat(6.28f);
            }
            noiseRotation += 0.02f;

            if (Main.rand.Next(5) == 1)
            {
                StarParticle particle = new StarParticle(
                    projectile.Center + Main.rand.NextVector2Circular(5, 5),
                    projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)) * 0.1f,
                    new Color(48, 255, 176),
                    Main.rand.NextFloat(0.08f, 0.23f),
                    Main.rand.Next(20, 40));

                ParticleHandler.SpawnParticle(particle);
            }

            projectile.rotation = projectile.velocity.ToRotation() + 1.57f;
            Lighting.AddLight(new Vector2(projectile.Center.X, projectile.Center.Y), 0.075f * .75f, 0.255f * .75f, 0.193f * .75f);
        }
コード例 #21
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            for (int i = 0; i < 6; i++)
            {
                Vector2 vel = Vector2.Zero - projectile.velocity;
                vel.Normalize();
                vel  = vel.RotatedBy(Main.rand.NextFloat(-0.5f, 0.5f));
                vel *= Main.rand.NextFloat(2, 5);
                ImpactLine line = new ImpactLine(target.Center - (vel * 10), vel, Main.rand.NextBool() ? new Color(125, 255, 253) : new Color(48, 255, 176), new Vector2(0.25f, Main.rand.NextFloat(0.5f, 1.5f)), 70);
                line.TimeActive = 30;
                ParticleHandler.SpawnParticle(line);
            }

            for (int j = 0; j < 10; j++)
            {
                Vector2 vel      = Vector2.Zero - projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)) * 0.25f;
                int     timeLeft = Main.rand.Next(40, 100);

                StarParticle particle = new StarParticle(
                    projectile.Center + Main.rand.NextVector2Circular(10, 10) - (vel * 5),
                    vel + Main.rand.NextVector2Circular(3, 3),
                    new Color(48, 255, 176),
                    Main.rand.NextFloat(0.1f, 0.2f),
                    timeLeft);
                particle.TimeActive = (uint)(timeLeft / 2);
                ParticleHandler.SpawnParticle(particle);
            }
            StarParticle particle2 = new StarParticle(
                projectile.Center,
                Vector2.Zero,
                Color.White,
                0.6f,
                20);

            ParticleHandler.SpawnParticle(particle2);
        }
コード例 #22
0
        public override void Kill(Player attackPlayer)
        {
            Vector2 screenCenter = new Vector2(Main.screenWidth, Main.screenHeight) / 2f + Main.screenPosition;

            Main.PlaySound(SoundID.Item10, (int)screenCenter.X, (int)screenCenter.Y + -30);
            Size.X     = 20;
            Size.Y     = 20;
            Position.X = CardGameUI.ToUIPos(Center).X - Size.X / 2f;
            Position.Y = CardGameUI.ToUIPos(Center).Y - Size.Y / 2f;
            for (int i = 0; i < 23; i++)
            {
                FireParticle particle = new FireParticle()
                {
                    Position        = Position,
                    UIPosition      = UIPosition,
                    Alpha           = 100,
                    IsPanelParticle = true
                };
                particle.Setup(Size, 1f, attackPlayer);
                if (Main.rand.Next(2) == 0)
                {
                    particle.Scale = 0.5f;
                }
                particle.Velocity *= 2f;
                attackPlayer.GetModPlayer <EntrogicPlayer>()._particles.Add(particle);
            }
            for (int j = 0; j < 20; j++)
            {
                FireParticle2 particle = new FireParticle2()
                {
                    Position        = Position,
                    UIPosition      = UIPosition,
                    Alpha           = 100,
                    IsPanelParticle = true
                };
                particle.Setup(Size, 1f, attackPlayer);
                particle.Velocity *= 2f;
                attackPlayer.GetModPlayer <EntrogicPlayer>()._particles.Add(particle);
            }
            for (int k = 0; k < Main.rand.Next(5, 7); k++)
            {
                float scaleFactor = 0.33f;
                if (k % 3 == 1)
                {
                    scaleFactor = 0.66f;
                }
                if (k % 3 == 1)
                {
                    scaleFactor = 1f;
                }
                StarParticle particle = new StarParticle()
                {
                    Position        = Position,
                    UIPosition      = UIPosition,
                    Alpha           = Main.rand.Next(140, 201),
                    IsPanelParticle = true
                };
                particle.Setup(Size, Main.rand.NextFloat() * 0.5f + 1f, attackPlayer);
                particle.Velocity *= scaleFactor;
                attackPlayer.GetModPlayer <EntrogicPlayer>()._particles.Add(particle);
            }
            //for (float rad = 0.0f; rad < 2 * 3.141f; rad += (float)Main.rand.Next(8, 14) / 10)
            //{
            //    Vector2 vec = new Vector2(120f, 0f);
            //    Vector2 finalVec = (vec.ToRotation() + rad).ToRotationVector2() * 16f;
            //    Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next(-10, 11), Main.rand.Next(-10, 11), ProjectileType<PineapplePieces>(), 21, 0f, projectile.owner, 0f, 0f);
            //}
            base.Kill(attackPlayer);
        }
コード例 #23
0
        public override bool PreAI()
        {
            growCounter++;
            if (growCounter == 10)
            {
                Main.PlaySound(SpiritMod.Instance.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/ElectricCharge").WithPitchVariance(0.4f).WithVolume(0.2f), projectile.Center);
            }
            Player player = Main.player[projectile.owner];

            if (player.statMana <= 0)
            {
                projectile.Kill();
            }
            if (projectile.owner == Main.myPlayer)
            {
                Vector2 direction2 = Main.MouseWorld - (projectile.position);
                direction2.Normalize();
                direction2          *= counter;
                projectile.ai[0]     = direction2.X;
                projectile.ai[1]     = direction2.Y;
                projectile.netUpdate = true;
            }
            Vector2 direction = new Vector2(projectile.ai[0], projectile.ai[1]);

            if (player.channel && !firing)
            {
                projectile.position = player.position + holdOffset;
                if (Main.rand.Next(4) == 0)
                {
                    Dust.NewDustDirect(projectile.Center + ((projectile.rotation + 1.57f).ToRotationVector2() * Main.rand.Next(-30, 30)), 2, 2, DustID.Firework_Yellow).noGravity = true;
                }

                if (Main.rand.Next(8) == 0)
                {
                    int          timeLeft = Main.rand.Next(20, 50);
                    StarParticle particle = new StarParticle(
                        projectile.Center + ((projectile.rotation + 1.57f).ToRotationVector2() * Main.rand.Next(-30, 30)),
                        Main.rand.NextVector2Circular(1.5f, 1.5f),
                        Color.Gold,
                        Main.rand.NextFloat(0.1f, 0.2f),
                        timeLeft);
                    ParticleHandler.SpawnParticle(particle);
                }

                if (counter < 15)
                {
                    counter += 0.30f;
                    manaCounter++;
                    if (manaCounter % 7 == 0)
                    {
                        if (player.statMana > 0)
                        {
                            player.statMana      -= 5;
                            player.manaRegenDelay = 60;
                            if (player.statMana <= 0)
                            {
                                Launch(player, direction);
                            }
                        }
                        else
                        {
                            firing = true;
                        }
                    }
                }
                else if (!charged)
                {
                    charged = true;
                    Main.PlaySound(SoundID.NPCDeath7, projectile.Center);
                }
                else
                {
                    glowCounter += 0.025f;
                }
                projectile.rotation = direction.ToRotation() - 1.57f;
                if (direction.X > 0)
                {
                    holdOffset.X     = -10;
                    player.direction = 1;
                }
                else
                {
                    holdOffset.X     = 10;
                    player.direction = 0;
                }
                trailcounter++;
            }
            else
            {
                Launch(player, direction);
                projectile.active = false;
            }
            player.heldProj      = projectile.whoAmI;
            player.itemTime      = 30;
            player.itemAnimation = 30;
            //	player.itemRotation = 0;
            return(true);
        }