Exemplo n.º 1
0
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            application.ContentRootDirectory = "Content";

            var screen = new ScreenDetails(application, mainWindow);

            var      logger   = new ConsoleLogger(GridGame.Library.Enums.LogLevel.debug);
            GameData gameData = new GameData(logger)
            {
                Screen = screen,
                Input  = new EnvironmentInputs(),
                Player = new PlayerPosition(),
            };


            screen.SetDefaultDesignResolution();


            var scene       = new CCScene(mainWindow);
            var introLayer  = new TerrainLayer(gameData);
            var playerLayer = new PlayerLayer(gameData);

            scene.AddChild(introLayer);
            scene.AddChild(playerLayer);

            mainWindow.RunWithScene(scene);
        }
Exemplo n.º 2
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            Action <PlayerDrawInfo> backTarget = s => DrawShards(s, false);                                           //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
            PlayerLayer             backLayer  = new PlayerLayer("VitricLayer", "Vitric Armor Effect", backTarget);   //Instantiate a new instance of PlayerLayer to insert into the list

            layers.Insert(layers.IndexOf(layers.First()), backLayer);                                                 //Insert the layer at the appropriate index.

            Action <PlayerDrawInfo> frontTarget = s => DrawShards(s, true);                                           //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
            PlayerLayer             frontLayer  = new PlayerLayer("VitricLayer", "Vitric Armor Effect", frontTarget); //Instantiate a new instance of PlayerLayer to insert into the list

            layers.Insert(layers.IndexOf(layers.Last()), frontLayer);                                                 //Insert the layer at the appropriate index.

            void DrawShards(PlayerDrawInfo info, bool back)
            {
                List <VitricArmorProjectile> allshards = new List <VitricArmorProjectile>();

                foreach (Projectile shard in Main.projectile.Where(proj => proj.active && proj.owner == player.whoAmI && proj.modProjectile != null && proj.modProjectile is VitricArmorProjectile))
                {
                    VitricArmorProjectile moddedproj = shard.modProjectile as VitricArmorProjectile;
                    allshards.Add(moddedproj);
                }

                allshards = allshards.OrderBy((x) => x.projectile.Center.Y).ToList();

                foreach (VitricArmorProjectile modshard in allshards)
                {
                    double angle = Math.Sin(-modshard.projectile.localAI[1]);
                    if ((angle > 0 && !back) ||
                        (angle <= 0 && back))
                    {
                        Main.playerDrawData.Add(modshard.Draw());
                    }
                }
            }
        }
Exemplo n.º 3
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            MiscEffectsBack.visible = true;
            layers.Insert(0, MiscEffectsBack);
            MiscEffects.visible = true;
            layers.Add(MiscEffects);

            /* This shows an example of how we can give the held sprite of an item a glowmask or animation. This example goes over drawing a mask for a specific item, but you may want to
             * expand your layer to cover multiple items, rather than adding in a new layer for every single item you want to create a mask for.
             *
             * PlayerLayers have many other uses, basically anything you would want to visually create on a player, such as a custom accessory layer, holding a weapon, or anything else you can think of
             * that would involve drawing sprites on a player or their held items. these examples only serve to illustrate common requests and can be extrapolated into anything you want. DrawData's constructor has
             * the same set of params as SpriteBatch.Draw(), so you can get as creative as you want here.
             *
             * Note that if you want to give your held item an animation, you should set that item's NoUseGraphic field to true so that the entire spritesheet for that item wont draw.
             */

            //This layer is for our glowing sword example!
            Action <PlayerDrawInfo> layerTarget = s => DrawSwordGlowmask(s);                                    //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
            PlayerLayer             layer       = new PlayerLayer("ExampleMod", "Sword Glowmask", layerTarget); //Instantiate a new instance of PlayerLayer to insert into the list

            layers.Insert(layers.IndexOf(layers.FirstOrDefault(n => n.Name == "Arms")), layer);                 //Insert the layer at the appropriate index.
            //the "Arms" layer is directly above the "HeldItem" layer so our layer will appear below the players hand and above their item.

            //this layer is for our animated sword example! this is pretty much the same as the above layer insertion.
            Action <PlayerDrawInfo> layerTarget2 = s => DrawSwordAnimation(s);
            PlayerLayer             layer2       = new PlayerLayer("ExampleMod", "Sword Animation", layerTarget2);

            layers.Insert(layers.IndexOf(layers.FirstOrDefault(n => n.Name == "Arms")), layer2);
        }
Exemplo n.º 4
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            if (player.HeldItem.modItem is Items.SignatureItems.PaintSplatteredBrush)
            {
                PlayerLayer.HeldItem.visible = false;
            }

            Action <PlayerDrawInfo> layerTarget = DrawGlowmasks;                                                       //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
            PlayerLayer             layer       = new PlayerLayer("ExampleSwordLayer", "Sword Glowmask", layerTarget); //Instantiate a new instance of PlayerLayer to insert into the list

            layers.Insert(layers.IndexOf(layers.FirstOrDefault(n => n.Name == "Arms")), layer);                        //Insert the layer at the appropriate index.

            if (player.statLife > 0)
            {
                MiscEffects.visible = true;
                layers.Add(MiscEffects);
            }

            void DrawGlowmasks(PlayerDrawInfo info)
            {
                if (info.drawPlayer.HeldItem.modItem is Items.IPlayerLayerDrawable)
                {
                    (info.drawPlayer.HeldItem.modItem as Items.IPlayerLayerDrawable).DrawGlowmask(info);
                }
            }
        }
Exemplo n.º 5
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            int hair = layers.FindIndex(l => l == PlayerLayer.Hair);

            if (hair < 0)
            {
                return;
            }
            if (Hair != null)
            {
                layers[hair] = new PlayerLayer(mod.Name, "TransHair",
                                               delegate(PlayerDrawInfo draw)
                {
                    Player player = draw.drawPlayer;
                    //if (!MyPlayer.ModPlayer(player).IsTransformed)
                    // return;

                    Color alpha   = draw.drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)(draw.position.X + draw.drawPlayer.width * 0.5) / 16, (int)((draw.position.Y + draw.drawPlayer.height * 0.25) / 16.0), Color.White), draw.shadow);
                    DrawData data = new DrawData(Hair, new Vector2((float)((int)(draw.position.X - Main.screenPosition.X - (float)(player.bodyFrame.Width / 2) + (float)(player.width / 2))), (float)((int)(draw.position.Y - Main.screenPosition.Y + (float)player.height - (float)player.bodyFrame.Height + 4f))) + player.headPosition + draw.headOrigin, player.bodyFrame, alpha, player.headRotation, draw.headOrigin, 1f, draw.spriteEffects, 0);
                    data.shader   = draw.hairShader;
                    Main.playerDrawData.Add(data);
                });
            }
            if (Hair != null)
            {
                PlayerLayer.Head.visible = false;
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Attempts to add the given <see cref="PlayerLayer"/> to <paramref name="layers"/>.
 /// If <see cref="Valid"/> is <see langword="false"/>, this will do nothing and return <see langword="false"/>.
 /// </summary>
 /// <param name="layers">The <see cref="List{T}"/> of <see cref="PlayerLayer"/> to insert in.</param>
 /// <param name="playerLayer"><see cref="PlayerLayer"/> to use for this <see cref="Animation"/>.</param>
 /// <returns><see langword="true"/> if <paramref name="playerLayer"/> was inserted; otherwise, <see langword="false"/>.</returns>
 public bool TryAddToLayers(List <PlayerLayer> layers, PlayerLayer playerLayer)
 {
     if (Valid)
     {
         layers.Add(playerLayer);
     }
     return(Valid);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Attempts to insert the given <see cref="PlayerLayer"/> to <paramref name="layers"/>. If <see cref="Valid"/> is <see langword="false"/>,
 /// this will do nothing and return <see langword="false"/>.
 /// </summary>
 /// <param name="layers">The <see cref="List{T}"/> of <see cref="PlayerLayer"/> to insert in.</param>
 /// <param name="playerLayer"><see cref="PlayerLayer"/> to use for this <see cref="Animation"/>.</param>
 /// <param name="idx">Position to insert the <paramref name="playerLayer"/> into.</param>
 /// <returns><see langword="true"/> if <paramref name="playerLayer"/> was inserted; otherwise, <see langword="false"/>.</returns>
 public bool TryAddToLayers(List <PlayerLayer> layers, PlayerLayer playerLayer, int idx)
 {
     if (Valid)
     {
         layers.Insert(idx, playerLayer);
     }
     return(Valid);
 }
Exemplo n.º 8
0
        public static void AddPlayerLayer(List <PlayerLayer> layers, PlayerLayer layer, PlayerLayer parent)
        {
            int index = layers.IndexOf(parent);

            if (index != -1)
            {
                layers.Insert(index + 1, layer);
            }
        }
Exemplo n.º 9
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            int count = layers.Count;

            if (!player.dead)
            {
                if (wearingAutonomousOrb)
                {
                    for (int i = 0; i < count; i++)
                    {
                        PlayerLayer layer = layers[i];
                        if (layer.Name == "Head")
                        {
                            if (i != layers.Count - 1)
                            {
                                layers.Insert(i + 1, HatEffects.AutonomousOrb);
                            }
                            else
                            {
                                layers.Add(HatEffects.AutonomousOrb);
                            }
                            break;
                        }
                    }
                }
                if (tallHat != TallHat.None)
                {
                    for (int i = 0; i < count; i++)
                    {
                        PlayerLayer layer = layers[i];
                        if (layer.Name == "Head")
                        {
                            if (i != layers.Count - 1)
                            {
                                layers.Insert(i + 1, HatEffects.TallHatLayer);
                            }
                            else
                            {
                                layers.Add(HatEffects.TallHatLayer);
                            }
                            break;
                        }
                    }
                }
                if (unusual != 0)
                {
                    AnimationHelper.unusual.visible = true;
                    layers.Insert(0, AnimationHelper.unusual);
                    layers.Add(AnimationHelper.unusualFront);
                }
                if (holdingAmmoGun)
                {
                    AnimationHelper.ammoGunCounter.visible = true;
                    layers.Add(AnimationHelper.ammoGunCounter);
                }
            }
        }
Exemplo n.º 10
0
        ////////////////

        private bool ModifyDrawLayersForGun(List <PlayerLayer> layers, bool aimGun)
        {
            PlayerLayer             plrLayer;
            Action <PlayerDrawInfo> armLayer, itemLayer, handLayer;

            int newBodyFrameY;

            if (aimGun)
            {
                newBodyFrameY = PlayerLogic.GetBodyFrameForItemAimAsIfForHeldGun(this.player);
            }
            else
            {
                newBodyFrameY = this.player.bodyFrame.Height * 3;
            }

            //

            if (!PlayerDraw.GetPlayerLayersForItemHolding(this.player, newBodyFrameY, out armLayer, out itemLayer, out handLayer))
            {
                return(false);
            }

            //

            int armLayerIdx = layers.FindIndex(lyr => lyr == PlayerLayer.Arms);

            if (armLayerIdx != -1)
            {
                plrLayer = new PlayerLayer("TheMadRanger", "Item Holding Arm", armLayer);
                layers.Insert(armLayerIdx + 1, plrLayer);
            }
            int itemLayerIdx = layers.FindIndex(lyr => lyr == PlayerLayer.HeldItem);

            if (itemLayerIdx != -1)
            {
                plrLayer = new PlayerLayer("TheMadRanger", "Held Item", itemLayer);
                layers.Insert(itemLayerIdx + 1, plrLayer);
            }
            int handLayerIdx = layers.FindIndex(lyr => lyr == PlayerLayer.HandOnAcc);

            if (handLayerIdx != -1)
            {
                plrLayer = new PlayerLayer("TheMadRanger", "Item Holding Hand", handLayer);
                layers.Insert(handLayerIdx + 1, plrLayer);
            }

            PlayerLayer.HeldItem.visible   = false;
            PlayerLayer.Arms.visible       = false;
            PlayerLayer.HandOnAcc.visible  = false;
            PlayerLayer.HandOffAcc.visible = false;
            this.player.handon             = 0;
            this.player.handoff            = 0;

            return(true);
        }
Exemplo n.º 11
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            int[] valids = { ModContent.ItemType <PowerGloveV1>(), ModContent.ItemType <PowerGloveV2>(), ModContent.ItemType <PowerGloveV3>(), ModContent.ItemType <PowerGloveVMax>() };
            if (valids.Contains(player.HeldItem.type))
            {
                PlayerLayer layer = null;
                foreach (PlayerLayer l in layers)
                {
                    if (l.Name == "HeldItem")

                    {
                        layer = l;
                        break;
                    }
                }
                layers.Remove(layer);
                layers.Add(layer);
            }
            if (player.mount.Type == ModContent.GetInstance <StartingShip>().Type)
            {
                foreach (PlayerLayer l in layers)
                {
                    if (l.Name == "Arms")

                    {
                        layers.Remove(l);
                        break;
                    }
                }
            }
            else if (player.mount.Type == ModContent.GetInstance <Mech>().Type)
            {
                foreach (PlayerLayer l in layers)
                {
                    if (l.Name == "HeldItem")

                    {
                        layers.Remove(l);
                        break;
                    }
                }
                foreach (PlayerLayer l in layers)
                {
                    if (l.Name == "Arms")

                    {
                        layers.Remove(l);
                        //layers.Insert()
                        break;
                    }
                }
            }
            //layers[0].
            //layers.Add(new PlayerLayer())
            base.ModifyDrawLayers(layers);
        }
Exemplo n.º 12
0
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            application.ContentRootDirectory = "Content";
            var windowSize = mainWindow.WindowSizeInPixels;

            var desiredWidth  = 1024.0f;
            var desiredHeight = 768.0f;


            var screen = new ScreenDetails
            {
                Height = desiredHeight,
                Width  = desiredWidth
            };


            GameData gameData = new GameData
            {
                Screen = screen,
                Input  = new EnvironmentInputs(),
                Player = new PlayerPosition(),
            };


            // This will set the world bounds to be (0,0, w, h)
            // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved
            CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);

            // Determine whether to use the high or low def versions of our images
            // Make sure the default texel to content size ratio is set correctly
            // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd)
            if (desiredWidth < windowSize.Width)
            {
                application.ContentSearchPaths.Add("hd");
                CCSprite.DefaultTexelToContentSizeRatio = 2.0f;
            }
            else
            {
                application.ContentSearchPaths.Add("ld");
                CCSprite.DefaultTexelToContentSizeRatio = 1.0f;
            }

            var scene       = new CCScene(mainWindow);
            var introLayer  = new TerrainLayer(gameData);
            var playerLayer = new PlayerLayer(gameData);

            scene.AddChild(introLayer);
            scene.AddChild(playerLayer);

            mainWindow.RunWithScene(scene);
        }
Exemplo n.º 13
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            void DrawGlowmasks(PlayerDrawInfo info)
            {
                Action <PlayerDrawInfo> layerTarget = DrawGlowmasks;
                PlayerLayer             layer       = new PlayerLayer("GoldLeaf", "GoldLeaf Item Layer", layerTarget);

                layers.Insert(layers.IndexOf(layers.FirstOrDefault(n => n.Name == "Arms")), layer);

                if (info.drawPlayer.HeldItem.modItem is Items.IGlowingItem)
                {
                    (info.drawPlayer.HeldItem.modItem as Items.IGlowingItem).DrawGlowmask(info);
                }
            }
        }
Exemplo n.º 14
0
        public static PlayerLayer CreateShaderLayer(string name, PlayerLayer parent, Func <PlayerDrawInfo, DrawDataInfo> getDataFunc)
        {
            return(new PlayerLayer("ModLoaderMod", name, parent, (drawInfo) =>
            {
                if (drawInfo.shadow != 0f || drawInfo.drawPlayer.invis)
                {
                    return;
                }

                DrawDataInfo drawDataInfo = getDataFunc.Invoke(drawInfo);
                Player drawPlayer = drawInfo.drawPlayer;
                DeveloperPlayer devPlayer = DeveloperPlayer.GetPlayer(drawPlayer);
                SpriteEffects effects = SpriteEffects.None;
                if (drawPlayer.direction == -1)
                {
                    effects |= SpriteEffects.FlipHorizontally;
                }

                if (drawPlayer.gravDir == -1)
                {
                    effects |= SpriteEffects.FlipVertically;
                }

                DrawData data = new DrawData(
                    drawDataInfo.Texture,
                    drawDataInfo.Position,
                    drawDataInfo.Frame,
                    Color.White * Main.essScale * devPlayer.AndromedonEffect.LayerStrength * devPlayer.AndromedonEffect.ShaderStrength,
                    drawDataInfo.Rotation,
                    drawDataInfo.Origin,
                    1f,
                    effects,
                    0);

                BeginShaderBatch(Main.spriteBatch);
                ShaderId = ShaderId ?? GameShaders.Armor.GetShaderIdFromItemId(ItemID.LivingRainbowDye);
                GameShaders.Armor.Apply(ShaderId.Value, drawPlayer, data);
                var centerPos = data.position;

                for (int i = 0; i < ShaderNumSegments; i++)
                {
                    data.position = centerPos + GetDrawOffset(i);
                    data.Draw(Main.spriteBatch);
                }

                data.position = centerPos;
            }));
        }
Exemplo n.º 15
0
 public override void ModifyDrawLayers(List <PlayerLayer> layers)
 {
     if (player.HeldItem.type == ModContent.ItemType <AbSolution>())
     {
         for (int i = 0; i < layers.Count; i++)
         {
             if (layers[i].Name == "MiscEffectsBack")
             {
                 layers[i] = new PlayerLayer("Artifice", "AbsolutionLayer", (layer) => {
                     Main.playerDrawData.Add(new DrawData(Main.BackPackTexture[2], new Vector2((float)((int)(layer.position.X - Main.screenPosition.X + (float)(layer.drawPlayer.width / 2) - (float)(9 * layer.drawPlayer.direction))) + -4 * (float)layer.drawPlayer.direction, (float)((int)(layer.position.Y - Main.screenPosition.Y + (float)(layer.drawPlayer.height / 2) + 2f * layer.drawPlayer.gravDir + -8 * layer.drawPlayer.gravDir))), new Rectangle?(new Rectangle(0, 0, Main.BackPackTexture[2].Width, Main.BackPackTexture[2].Height)), default(Color), layer.drawPlayer.bodyRotation, new Vector2((float)(Main.BackPackTexture[2].Width / 2), (float)(Main.BackPackTexture[2].Height / 2)), 1f, SpriteEffects.None, 0));
                 });
                 break;
             }
         }
     }
 }
Exemplo n.º 16
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            Action <PlayerDrawInfo> backTarget = s => DrawGlowmasks(s, false);                                      //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
            PlayerLayer             backLayer  = new PlayerLayer("PalestoneLayer", "Armor Glowmask", backTarget);   //Instantiate a new instance of PlayerLayer to insert into the list

            layers.Insert(layers.IndexOf(layers.First()), backLayer);                                               //Insert the layer at the appropriate index.

            Action <PlayerDrawInfo> frontTarget = s => DrawGlowmasks(s, true);                                      //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
            PlayerLayer             frontLayer  = new PlayerLayer("PalestoneLayer", "Armor Glowmask", frontTarget); //Instantiate a new instance of PlayerLayer to insert into the list

            layers.Insert(layers.IndexOf(layers.Last()), frontLayer);                                               //Insert the layer at the appropriate index.

            float getTabletRotation(int currentTablet) => currentTablet / (tablets.FirstOrDefault(x => x == 0) + 1) * 6.28f + (float)player.GetModPlayer <StarlightPlayer>().Timer % 120 / 120 * 6.28f;

            Vector2 getTabletPosition(int currentTablet)
            {
                float dist = 50;
                float rot  = getTabletRotation(currentTablet);

                float posX = player.Center.X + (float)(Math.Cos(rot) * dist);
                float posY = player.Center.Y + (float)(Math.Sin(rot) * dist) / 2;

                return(new Vector2(posX, posY));
            }

            void DrawGlowmasks(PlayerDrawInfo info, bool back)
            {
                for (int k = 0; k < tablets.Length; k++)
                {
                    float rot = getTabletRotation(k);
                    if ((back && rot % 6.28f < 3.14f || !back && rot % 6.28f >= 3.14f) && tablets[k] > 0)
                    {
                        Vector2   pos     = getTabletPosition(k);
                        Texture2D texture = GetTexture("StarlightRiver/Items/Armor/Palestone/Tablet");
                        Main.playerDrawData.Add(new DrawData(
                                                    texture,
                                                    pos,                                                                                        //position
                                                    new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), //source
                                                    Lighting.GetColor((int)pos.X / 16, (int)pos.Y / 16),                                        //color
                                                    0,                                                                                          //rotation
                                                    new Vector2(texture.Width / 2, texture.Height / 2),                                         //origin
                                                    1f,                                                                                         //scale
                                                    SpriteEffects.None, 0));
                    }
                }
            }
        }
Exemplo n.º 17
0
        private void ComputeLayer()
        {
            PlayerLayer newLayer = PlayerLayer.Player;

            foreach (PlayerLayer layer in calledLayers.Values)
            {
                if ((int)layer > (int)newLayer)
                {
                    newLayer = layer;
                }
            }

            if (newLayer != currentLayer)
            {
                recSetLayer(gameObject, layerNames[(int)currentLayer], layerNames[(int)newLayer]);
                currentLayer = newLayer;
            }
        }
Exemplo n.º 18
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            PlayerLayer layer = new PlayerLayer(mod.Name, "NClasses: Skill Effect Layer", delegate(PlayerDrawInfo pdi)
            {
                if (SkillBeingCasted != null)
                {
                    SkillBase Base       = SkillBeingCasted.GetBase;
                    float CastPercentage = (SkillBeingCasted.CastTime / Base.CastTime);
                    float Scale          = Base.GetEffectRange(SkillBeingCasted);
                    Terraria.DataStructures.DrawData dd;
                    if (Scale > 0)
                    {
                        Scale          /= 64;
                        Vector2 DrawPos = SkillBeingCasted.CastPosition - Main.screenPosition;
                        dd =
                            new Terraria.DataStructures.DrawData(MainMod.MagicCircle, DrawPos, null, Color.White * CastPercentage * Main.cursorAlpha, SkillBeingCasted.CastTime * 0.017f,
                                                                 new Vector2(48, 48), Scale, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0);
                        dd.ignorePlayerRotation = true;
                        Main.playerDrawData.Add(dd);
                    }
                    float BarScale          = 1 + CastPercentage * 62;
                    Vector2 CastBarPosition = player.Top - Main.screenPosition;
                    CastBarPosition.X       = (int)(CastBarPosition.X - 32);
                    CastBarPosition.Y       = (int)(CastBarPosition.Y - 12);
                    dd =
                        new Terraria.DataStructures.DrawData(MainMod.CastBar, CastBarPosition, new Rectangle(0, 0, 64, 8), Color.White);
                    dd.ignorePlayerRotation = true;
                    Main.playerDrawData.Add(dd);
                    dd =
                        new Terraria.DataStructures.DrawData(MainMod.CastBar, CastBarPosition, new Rectangle(0, 8, (int)BarScale, 8), Color.White * Main.cursorAlpha);
                    dd.ignorePlayerRotation = true;
                    Main.playerDrawData.Add(dd);
                }
                foreach (SkillData sd in GetSkillsUnderEffect)
                {
                    if (sd.CastTime >= sd.GetBase.CastTime)
                    {
                        sd.GetBase.Draw(player, sd, pdi);
                    }
                }
            });

            layers.Add(layer);
        }
Exemplo n.º 19
0
        public static PlayerLayer CreateGlowLayer(string name, PlayerLayer parent, Func <PlayerDrawInfo, DrawDataInfo> getDataFunc)
        {
            return(new PlayerLayer("ModLoaderMod", name, parent, (drawInfo) =>
            {
                if (drawInfo.shadow != 0f || drawInfo.drawPlayer.invis)
                {
                    return;
                }

                DrawDataInfo drawDataInfo = getDataFunc.Invoke(drawInfo);

                Player drawPlayer = drawInfo.drawPlayer;
                DeveloperPlayer devPlayer = DeveloperPlayer.GetPlayer(drawPlayer);
                SpriteEffects effects = SpriteEffects.None;
                if (drawPlayer.direction == -1)
                {
                    effects |= SpriteEffects.FlipHorizontally;
                }

                if (drawPlayer.gravDir == -1)
                {
                    effects |= SpriteEffects.FlipVertically;
                }

                DrawData data = new DrawData(
                    drawDataInfo.Texture,
                    drawDataInfo.Position,
                    drawDataInfo.Frame,
                    Color.White * Main.essScale * devPlayer.AndromedonEffect.LayerStrength,
                    drawDataInfo.Rotation,
                    drawDataInfo.Origin,
                    1f,
                    effects,
                    0);

                if (devPlayer.AndromedonEffect.HasAura)
                {
                    ShaderId = ShaderId ?? GameShaders.Armor.GetShaderIdFromItemId(ItemID.LivingRainbowDye);
                    data.shader = ShaderId.Value;
                }
                Main.playerDrawData.Add(data);
            }));
        }
        /// <summary>
        /// Initialize the ModPlayer.
        /// </summary>
        public override void Initialize()
        {
            EquipWingSlot = new UIItemSlot(Vector2.Zero, context: Contexts.EquipAccessory, hoverText: "Wings",
                                           conditions: Slot_Conditions, drawBackground: Slot_DrawBackground, scaleToInventory: true);
            VanityWingSlot = new UIItemSlot(Vector2.Zero, context: Contexts.EquipAccessoryVanity, hoverText:
                                            Language.GetTextValue("LegacyInterface.11") + " Wings",
                                            conditions: Slot_Conditions, drawBackground: Slot_DrawBackground, scaleToInventory: true);
            WingDyeSlot = new UIItemSlot(Vector2.Zero, context: Contexts.EquipDye, conditions: WingDyeSlot_Conditions,
                                         drawBackground: WingDyeSlot_DrawBackground, scaleToInventory: true);
            VanityWingSlot.Partner    = EquipWingSlot;
            EquipWingSlot.BackOpacity = VanityWingSlot.BackOpacity = WingDyeSlot.BackOpacity = .8f;

            // Big thanks to thegamemaster1234 for the example code used to write this!
            wingsDye = new PlayerLayer(UIUtils.Mod.Name, WING_DYE_LAYER, delegate(PlayerDrawInfo drawInfo) {
                Player player      = drawInfo.drawPlayer;
                WingSlotPlayer wsp = player.GetModPlayer <WingSlotPlayer>(UIUtils.Mod);
                Item wings         = wsp.GetDyedWings();
                Item dye           = wsp.WingDyeSlot.Item;
                int index          = Main.playerDrawData.Count - 1;

                if (dye.stack <= 0 || wings.stack <= 0 || !wings.active || wings.noUseGraphic || player.mount.Active ||
                    (wsp.VanityWingSlot.Item.stack <= 0 && !wsp.EquipWingSlot.ItemVisible && player.wingFrame == 0))
                {
                    return;
                }

                if (wings.flame)
                {
                    index -= 1;
                }

                if (index < 0 || index > Main.playerDrawData.Count)
                {
                    return;
                }

                DrawData data = Main.playerDrawData[index];
                data.shader   = GameShaders.Armor.GetShaderIdFromItemId(dye.type);
                Main.playerDrawData[index] = data;
            });

            InitializeWings();
        }
Exemplo n.º 21
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            if (player.HeldItem.modItem is Content.Items.Vitric.VitricSword && (player.HeldItem.modItem as Content.Items.Vitric.VitricSword).Broken)
            {
                PlayerLayer.HeldItem.visible = false;
            }

            Action <PlayerDrawInfo> layerTarget = DrawGlowmasks;
            PlayerLayer             layer       = new PlayerLayer("ItemLayer", "Starlight River Item Drawing Layer", layerTarget);

            layers.Insert(layers.IndexOf(layers.FirstOrDefault(n => n.Name == "Arms")), layer);

            void DrawGlowmasks(PlayerDrawInfo info)
            {
                if (info.drawPlayer.HeldItem.modItem is IGlowingItem)
                {
                    (info.drawPlayer.HeldItem.modItem as IGlowingItem).DrawGlowmask(info);
                }
            }

            #region armor masks
            Action <PlayerDrawInfo> helmetTarget = DrawHelmetMask;
            layers.Insert(layers.IndexOf(layers.FirstOrDefault(n => n.Name == "Head")) + 1, new PlayerLayer("SLRHelmet", "Helmet mask layer", helmetTarget));

            Action <PlayerDrawInfo> chestTarget = DrawChestMask;
            layers.Insert(layers.IndexOf(layers.FirstOrDefault(n => n.Name == "Body")) + 1, new PlayerLayer("SLRChest", "Chest mask layer", chestTarget));

            Action <PlayerDrawInfo> legTarget = DrawLegMask;
            layers.Insert(layers.IndexOf(layers.FirstOrDefault(n => n.Name == "Legs")) + 1, new PlayerLayer("SLRLeg", "Leg mask layer", legTarget));


            void DrawHelmetMask(PlayerDrawInfo info)
            {
                if (info.drawPlayer.armor[10].IsAir && info.drawPlayer.armor[0].modItem is IArmorLayerDrawable)
                {
                    (info.drawPlayer.armor[0].modItem as IArmorLayerDrawable).DrawArmorLayer(info);
                }
                else if (info.drawPlayer.armor[10].modItem is IArmorLayerDrawable)
                {
                    (info.drawPlayer.armor[10].modItem as IArmorLayerDrawable).DrawArmorLayer(info);
                }
            }

            void DrawChestMask(PlayerDrawInfo info)
            {
                if (info.drawPlayer.armor[11].IsAir && info.drawPlayer.armor[1].modItem is IArmorLayerDrawable)
                {
                    (info.drawPlayer.armor[1].modItem as IArmorLayerDrawable).DrawArmorLayer(info);
                }
                else if (info.drawPlayer.armor[11].modItem is IArmorLayerDrawable)
                {
                    (info.drawPlayer.armor[11].modItem as IArmorLayerDrawable).DrawArmorLayer(info);
                }
            }

            void DrawLegMask(PlayerDrawInfo info)
            {
                if (info.drawPlayer.armor[12].IsAir && info.drawPlayer.armor[2].modItem is IArmorLayerDrawable)
                {
                    (info.drawPlayer.armor[2].modItem as IArmorLayerDrawable).DrawArmorLayer(info);
                }
                else if (info.drawPlayer.armor[12].modItem is IArmorLayerDrawable)
                {
                    (info.drawPlayer.armor[12].modItem as IArmorLayerDrawable).DrawArmorLayer(info);
                }
            }

            #endregion
        }
Exemplo n.º 22
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            //handle lightning effects
            AnimationHelper.lightningEffects.visible = true;
            layers.Add(AnimationHelper.lightningEffects);

            // handle transformation animations
            AnimationHelper.transformationEffects.visible = true;
            layers.Add(AnimationHelper.transformationEffects);

            // handle dragon radar drawing
            if (isHoldingDragonRadarMk1 || isHoldingDragonRadarMk2 || isHoldingDragonRadarMk3)
            {
                AnimationHelper.dragonRadarEffects.visible = true;
                layers.Add(AnimationHelper.dragonRadarEffects);
            }

            if (isPlayerUsingKiWeapon)
            {
                AnimationHelper.kiChargeAttackEffects.visible = true;
                layers.Add(AnimationHelper.kiChargeAttackEffects);
            }

            AnimationHelper.auraEffect.visible = true;
            // capture the back layer index, which should always exist before the hook fires.
            var index = layers.FindIndex(x => x.Name == "MiscEffectsBack");

            layers.Insert(index, AnimationHelper.auraEffect);

            // handle SSJ hair/etc.
            int hair = layers.FindIndex(l => l == PlayerLayer.Hair);

            if (hair < 0)
            {
                return;
            }

            if (this.hair != null)
            {
                layers[hair] = new PlayerLayer(mod.Name, "TransHair",
                                               delegate(PlayerDrawInfo draw)
                {
                    // TODO Change this to use HairAppearance class.
                    Player player = draw.drawPlayer;

                    Color alpha   = draw.drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)(draw.position.X + draw.drawPlayer.width * 0.5) / 16, (int)((draw.position.Y + draw.drawPlayer.height * 0.25) / 16.0), Color.White), draw.shadow);
                    DrawData data = new DrawData(this.hair, new Vector2((int)(draw.position.X - Main.screenPosition.X - player.bodyFrame.Width / 2 + player.width / 2), (int)(draw.position.Y - Main.screenPosition.Y + player.height - player.bodyFrame.Height + 4f)) + player.headPosition + draw.headOrigin, player.bodyFrame, alpha, player.headRotation, draw.headOrigin, 1f, draw.spriteEffects, 0);
                    data.shader   = draw.hairShader;
                    Main.playerDrawData.Add(data);
                });
            }

            if (this.hair != null)
            {
                PlayerLayer.Head.visible     = false;
                PlayerLayer.Hair.visible     = false;
                PlayerLayer.HairBack.visible = false;
                PlayerHeadLayer.Hair.visible = false;
                PlayerHeadLayer.Head.visible = false;
            }
        }
Exemplo n.º 23
0
 public AuraDrawLayer(string mod, string name, PlayerLayer parent, AuraAnimationInfo aura, Action <PlayerDrawInfo> layer) : base(mod, name, parent, layer)
 {
     _aura = aura;
 }
Exemplo n.º 24
0
 public void Init()
 {
     calledLayers = new Dictionary <object, PlayerLayer>();
     currentLayer = PlayerLayer.Player;
 }
Exemplo n.º 25
0
 public void Disconnect()
 {
     PlayerLayer.RemoveFromSuperLayer();
 }
Exemplo n.º 26
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            PlayerTransformation transformation = GetTransformation();

            HandleAuraDrawLayers(layers);

            if (transformation == null)
            {
                if (originalEyeColor.HasValue && player.eyeColor != originalEyeColor.Value)
                {
                    player.eyeColor = originalEyeColor.Value;
                }

                //return;
            }

            HandleHairDrawLayers(layers);

            /*if (Trait == TraitManager.Instance.Primal)
             * {
             *
             * }*/
            tailLayer.visible = true;
            layers.Insert(layers.FindIndex(l => l.Name == "MiscEffectsBack"), tailLayer);

            furLayer.visible = true;

            PlayerLayer skinLayer = layers.Find(l => l.Name.Equals(nameof(PlayerLayer.Skin)));
            int         skinIndex = layers.IndexOf(skinLayer);


            for (int i = 0; i < ActiveTransformations.Count; i++)
            {
                if (ActiveTransformations[i].Appearance.ShouldHideNormalSkin)
                {
                    layers.RemoveAt(skinIndex);
                    layers.Insert(skinIndex, customBodySkin);

                    break;
                }
            }


            layers.Insert(skinIndex + 1, furLayer);

            // handle dragon radar drawing
            if (IsHoldingDragonRadarMk1 || IsHoldingDragonRadarMk2 || IsHoldingDragonRadarMk3)
            {
                DrawDragonRadar.dragonRadarEffects.visible = true;
                layers.Add(DrawDragonRadar.dragonRadarEffects);
            }

            if (transformation != null)
            {
                if (transformation.Definition.Appearance.EyeColor.HasValue)
                {
                    ChangeEyeColor(transformation.Definition.Appearance.EyeColor.Value);
                }
            }
            // handle transformation animations

            /*transformationEffects.visible = true;
             * layers.Add(transformationEffects);*/
        }
Exemplo n.º 27
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            if (isTransformed && mouseX != null && mouseY != null)
            {
                Tile           mouseOverTile = Main.tile[mouseX.GetValueOrDefault(), mouseY.GetValueOrDefault()];
                TileObjectData tileObject    = TileObjectData.GetTileData(mouseOverTile);
                PlayerLayer    propEffect    = new PlayerLayer("PropHuntMod", "PropEffect", delegate(PlayerDrawInfo drawInfo)
                {
                    Player drawPlayer         = drawInfo.drawPlayer;
                    Texture2D selectedTexture = Main.tileTexture[Main.tile[mouseX.GetValueOrDefault(), mouseY.GetValueOrDefault()].type];
                    int styleColumn           = 0;
                    int alternate             = 0;
                    TileObjectData.GetTileInfo(mouseOverTile, ref styleColumn, ref alternate);
                    int styleRow = 0;
                    if (tileObject.StyleWrapLimit > 0)
                    {
                        styleRow     = styleColumn / tileObject.StyleWrapLimit * tileObject.StyleLineSkip;
                        styleColumn %= tileObject.StyleWrapLimit;
                    }
                    int xPad;
                    int yPad;
                    if (tileObject.StyleHorizontal)
                    {
                        xPad = tileObject.CoordinateFullWidth * styleColumn;
                        yPad = tileObject.CoordinateFullHeight * styleRow;
                    }
                    else
                    {
                        xPad = tileObject.CoordinateFullWidth * styleRow;
                        yPad = tileObject.CoordinateFullHeight * styleColumn;
                    }
                    int width = tileObject.CoordinateFullWidth / 18;
                    int widthOffSetTexture = 0;
                    int[] heights          = tileObject.CoordinateHeights;
                    int playerX;
                    int playerY;
                    int extraPlayerVerticalPadding;
                    for (int x = 0; x < width; x++)
                    {
                        int heightOffSetTexture = 0;
                        for (int y = 0; y < heights.Length; y++)

                        {
                            if (heights.Length > 1)
                            {
                                extraPlayerVerticalPadding = 1;
                            }
                            else
                            {
                                extraPlayerVerticalPadding = 0;
                            }
                            playerX        = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X) + x * 16 - 12 - tileObject.CoordinatePadding * width;
                            playerY        = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y + y * 16 + 20 + heights.Length - tileObject.Height * 16 - extraPlayerVerticalPadding);
                            Rectangle rect = new Rectangle(xPad + widthOffSetTexture, yPad + heightOffSetTexture, tileObject.CoordinateWidth, tileObject.CoordinateHeights[y]);
                            Main.playerDrawData.Add(
                                new DrawData(selectedTexture, new Vector2(playerX, playerY), rect, Color.White)
                                );
                            heightOffSetTexture += heights[y] + tileObject.CoordinatePadding;
                        }
                        widthOffSetTexture += 16 + tileObject.CoordinatePadding;
                    }
                });
                PropEffect = propEffect;
                for (var i = 0; i < layers.Count; i++)
                {
                    layers[i].visible = false;
                }
                PropEffect.visible = true;
                layers.Add(PropEffect);
            }
            else
            {
                for (var i = 0; i < layers.Count; i++)
                {
                    layers[i].visible = true;
                }
                layers.Remove(PropEffect);
                PropEffect = null;
            }
        }
Exemplo n.º 28
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            if (EngieArmor())
            {
                int layerlocation      = layers.FindIndex(PlayerLayer => PlayerLayer.Name.Equals("Wings"));
                int layerlocationfront = layers.FindIndex(PlayerLayer => PlayerLayer.Name.Equals("Arms")) + 1;

                //Delete Wings
                layers.RemoveAt(layerlocation);


                //Ugly Layering Ordering Code here!

                //Supports
                Action <PlayerDrawInfo> backTarget = s => DrawEngineerArm(s, 12, new Vector2(0, -8));                //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
                PlayerLayer             backLayer  = new PlayerLayer("EngineerLayer", "Engineer Arm", backTarget);   //Instantiate a new instance of PlayerLayer to insert into the list
                layers.Insert(layerlocation, backLayer);                                                             //Insert the layer at the appropriate index.

                Action <PlayerDrawInfo> frontTarget = s => DrawEngineerArm(s, 6, new Vector2(-22, -8));              //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
                PlayerLayer             frontLayer  = new PlayerLayer("EngineerLayer", "Engineer Arm", frontTarget); //Instantiate a new instance of PlayerLayer to insert into the list
                layers.Insert(layerlocation, frontLayer);                                                            //Insert the layer at the appropriate index.

                frontTarget = s => DrawEngineerArm(s, 4, new Vector2(-22, -8));                                      //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
                frontLayer  = new PlayerLayer("EngineerLayer", "Engineer Arm", frontTarget);                         //Instantiate a new instance of PlayerLayer to insert into the list
                layers.Insert(layerlocationfront, frontLayer);                                                       //Insert the layer at the appropriate index.

                //GL/Jetpack
                backTarget = s => DrawEngineerArm(s, 3, new Vector2(0, -8));                    //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
                backLayer  = new PlayerLayer("EngineerLayer", "Engineer Arm GL", backTarget);   //Instantiate a new instance of PlayerLayer to insert into the list
                layers.Insert(layerlocation + 2, backLayer);                                    //Insert the layer at the appropriate index.

                frontTarget = s => DrawEngineerArm(s, 3, new Vector2(-22, -8));                 //the Action<T> of our layer. This is the delegate which will actually do the drawing of the layer.
                frontLayer  = new PlayerLayer("EngineerLayer", "Engineer Arm GL", frontTarget); //Instantiate a new instance of PlayerLayer to insert into the list
                layers.Insert(layerlocationfront + 2, frontLayer);                              //Insert the layer at the appropriate index.


                void DrawEngineerArm(PlayerDrawInfo info, int part, Vector2 bodyoffset)
                {
                    SpriteEffects direction       = player.direction > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
                    Vector2       facingdirection = new Vector2(player.direction, 1f);

                    //Ugly guessing-game-coded bobber effect
                    if ((player.bodyFrame.Y + player.bodyFrame.Height * 2) % (player.bodyFrame.Height * 6) > player.bodyFrame.Height * 3 && player.bodyFrame.Y > player.bodyFrame.Height * 6)
                    {
                        bodyoffset -= new Vector2(0, 2);
                    }

                    if (player.direction < 0)
                    {
                        bodyoffset   *= facingdirection;
                        bodyoffset.X -= player.width;
                    }

                    //Alotta predefined stuff for each part
                    string directory = "StarlightRiver/Items/Armor/Engineer/";

                    Texture2D[] ShoulderMounts = { ModContent.GetTexture(directory + "ShoulderMount1"), ModContent.GetTexture(directory + "ShoulderMount2"), ModContent.GetTexture(directory + "ShoulderLauncher1"), ModContent.GetTexture(directory + "ShoulderLauncher2") };
                    Vector2[]   spriteorigins  = { new Vector2(ShoulderMounts[0].Width - 4,     ShoulderMounts[0].Height - 4),
                                                   new Vector2(2,                                  ShoulderMounts[1].Height - 2),
                                                   new Vector2(4,                                  ShoulderMounts[2].Height / 2),
                                                   new Vector2((ShoulderMounts[3].Width / 4f) / 2, 2) };

                    Vector2[] partoffsets = { Vector2.Zero,
                                              new Vector2(-(ShoulderMounts[0].Width - 6),    -(ShoulderMounts[0].Height - 8)),
                                              new Vector2(ShoulderMounts[1].Width - 8,       -(ShoulderMounts[1].Height - 4)),
                                              new Vector2(4,                                (ShoulderMounts[2].Height / 2)),
                                              new Vector2((ShoulderMounts[3].Width / 4) - 8, -(ShoulderMounts[3].Height - 4)) };

                    //Redefined angles and some gentle idle animations
                    float[] rotationangles = { (float)Math.Sin(Main.GlobalTime * 0.75f) * 0.04f,
                                               (float)Math.Sin(Main.GlobalTime * 1f) * 0.06f,
                                               (float)Math.Sin(Main.GlobalTime * 1.33f) * 0.05f,
                                               (float)Noise.GetNoise(SLP.Timer * (bodyoffset.X < -11 ? 1f : -1f), SLP.Timer) / 5f };

                    //Sway backwards as the player moves
                    rotationangles[0] -= (float)Math.Pow(Math.Abs(EaseXVel / 20), 0.60);
                    rotationangles[1] -= (float)Math.Pow(Math.Abs(EaseXVel / 16), 0.70);

                    //Vertical movement
                    rotationangles[0] += (float)Math.Pow(Math.Abs(EaseYVel / 40), 0.60) * Math.Sign(EaseYVel);
                    rotationangles[1] -= (float)Math.Pow(Math.Abs(EaseYVel / 32), 0.70) * Math.Sign(EaseYVel);

                    //Transformation angles
                    rotationangles[1] += ((float)SLP.EngineerTransform / (float)MaxTransform) * (MathHelper.Pi / 1.5f);
                    if (TransformActive)
                    {
                        rotationangles[3] += (float)Math.Pow(Math.Abs((EaseXVel + (player.velocity.X / 3f)) / 18f), 0.60) * Math.Sign(EaseXVel + (player.velocity.X / 3f)) * player.direction;
                    }

                    //Support Arms
                    if (part % 2 == 0)
                    {
                        for (int i = 0; i < 2; i += 1)
                        {
                            if (part % (i + 3) == 0)
                            {
                                Vector2 spriteoriginlocal = new Vector2(XOffset(ShoulderMounts[i], (int)spriteorigins[i].X), spriteorigins[i].Y);
                                Vector2 partoffset        = ((partoffsets[i] * facingdirection).RotatedBy(i < 1 ? 0f : rotationangles[i - 1] * facingdirection.X));

                                Vector2  drawhere = player.position + info.bodyOrigin + bodyoffset + partoffset;
                                DrawData drawarm  = new DrawData(ShoulderMounts[i], drawhere - Main.screenPosition, null, info.middleArmorColor, rotationangles[i] * facingdirection.X, spriteoriginlocal, Vector2.One, direction, 0);

                                Main.playerDrawData.Add(drawarm);
                            }
                        }
                    }

                    //Pods/GL/Jetpack
                    if (part % 2 == 1)
                    {
                        int     isjetpack         = TransformActive ? 3 : 2;
                        Vector2 GLOffset          = Vector2.Zero;
                        Vector2 spriteoriginlocal = new Vector2(XOffset(ShoulderMounts[isjetpack], (int)spriteorigins[isjetpack].X), spriteorigins[isjetpack].Y);
                        for (int i = 0; i < 3; i += 1)
                        {
                            GLOffset += (partoffsets[i] * facingdirection).RotatedBy(i < 1 ? 0f : rotationangles[i - 1] * facingdirection.X);
                        }

                        Vector2  drawhere = player.position + info.bodyOrigin + bodyoffset + (GLOffset);
                        DrawData drawGL;

                        if (isjetpack == 3)
                        {
                            int       maxframes = 4;
                            Texture2D tex       = ShoulderMounts[3];
                            int       scale     = (tex.Width / maxframes);
                            Rectangle drawrect  = new Rectangle(((int)(SLP.Timer / 10) % maxframes) * scale, 0, scale, tex.Height);
                            drawGL = new DrawData(tex, drawhere - Main.screenPosition, drawrect, info.middleArmorColor, rotationangles[3] * facingdirection.X, spriteoriginlocal, Vector2.One, direction, 0);
                        }
                        else
                        {
                            float transformanimation = ((float)SLP.EngineerTransform / MaxTransform) * (MathHelper.Pi / 2f);
                            drawGL = new DrawData(ShoulderMounts[2], drawhere - Main.screenPosition, null, info.middleArmorColor, (rotationangles[2] + transformanimation) * facingdirection.X, spriteoriginlocal, Vector2.One, direction, 0);
                        }

                        Main.playerDrawData.Add(drawGL);
                    }

                    int XOffset(Texture2D tex, int x)
                    {
                        int texwidth = tex.Width;

                        if (tex == ShoulderMounts[3])
                        {
                            texwidth /= 4;
                        }

                        if (player.direction < 1)
                        {
                            x = texwidth - x;
                        }
                        return(x);
                    }
                }
            }
        }
Exemplo n.º 29
0
 public static void InsertAfterVanillaLayer(List <PlayerLayer> layers, string vanillaLayerName, PlayerLayer newPlayerLayer)
 {
     for (int i = 0; i < layers.Count; i++)
     {
         if (layers[i].Name == vanillaLayerName && layers[i].mod == "Terraria")
         {
             layers.Insert(i + 1, newPlayerLayer);
             return;
         }
     }
     layers.Add(newPlayerLayer);
 }
Exemplo n.º 30
0
 public void CallLayer(PlayerLayer layer, object caller)
 {
     calledLayers.Add(caller, layer);
     ComputeLayer();
 }