Ejemplo n.º 1
0
        private void OverrideHotbar(On.Terraria.Main.orig_DrawInterface_30_Hotbar orig, Main self)
        {
            orig(self);

            if (Main.LocalPlayer.HeldItem.type != ItemType <Datsuzei>())
            {
                if (activationTimer > 0)
                {
                    activationTimer -= 2;
                }
                else
                {
                    activationTimer = 0;
                    sparkles.ClearParticles();
                }
            }

            if (activationTimer > 0 && !Main.playerInventory)
            {
                var activationTimerNoCurve = Datsuzei.activationTimer;
                var activationTimer        = Helper.BezierEase(Math.Min(1, activationTimerNoCurve / 60f));

                var hideTarget = new Rectangle(20, 20, 446, 52);

                if (!Main.screenTarget.IsDisposed)
                {
                    Main.spriteBatch.Draw(Main.screenTarget, hideTarget, hideTarget, Color.White * activationTimer);
                }

                var backTex = GetTexture(AssetDirectory.MoonstoneItem + "DatsuzeiHotbar");
                var target  = new Rectangle(111, 20, (int)(backTex.Width * activationTimer), backTex.Height);
                var source  = new Rectangle(0, 0, (int)(backTex.Width * activationTimer), backTex.Height);

                Main.spriteBatch.Draw(backTex, target, source, Color.White);

                Main.spriteBatch.End();
                Main.spriteBatch.Begin(default, BlendState.Additive, default, default, default, default, Main.UIScaleMatrix);