Пример #1
0
        /// <summary>
        /// Creates an alternative style for the HatInfo's item, which is activated while wearing the enCombo item.
        /// <para>The paths to the texture are of format "Sprites/Equipment/Hats/[resource]/[Up, Right, Down or Left].xnb"</para>
        /// </summary>
        /// <remarks>You can set resource to something like "[hatResource]/[comboResource]/" to keep the textures for default and alternate set in the same hat folder.</remarks>
        public static void AddAltSet(this HatInfo xInfo, ItemCodex.ItemTypes enCombo, string sResource, ContentManager xContent)
        {
            if (!xInfo.denxAlternateVisualSets.ContainsKey(enCombo))
            {
                xInfo.denxAlternateVisualSets[enCombo] = new HatInfo.VisualSet();
            }

            string sHatPath = "Sprites/Equipment/Hats/" + sResource + "/";

            HatInfo.VisualSet xAlt = xInfo.denxAlternateVisualSets[enCombo];

            try
            {
                xAlt.atxTextures[0] = xContent.Load <Texture2D>(sHatPath + "Up");
                xAlt.atxTextures[1] = xContent.Load <Texture2D>(sHatPath + "Right");
                xAlt.atxTextures[2] = xContent.Load <Texture2D>(sHatPath + "Down");
                xAlt.atxTextures[3] = xContent.Load <Texture2D>(sHatPath + "Left");

                xInfo.sResourceName = sResource;
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed to load a texture in AddAltSet.");
                Console.WriteLine("Exception: " + e.Message);
                xAlt.atxTextures[0] = RenderMaster.txNullTex;
                xAlt.atxTextures[1] = RenderMaster.txNullTex;
                xAlt.atxTextures[2] = RenderMaster.txNullTex;
                xAlt.atxTextures[3] = RenderMaster.txNullTex;

                xInfo.sResourceName = "";
            }
        }
Пример #2
0
 public static void SetBehindCharacter(this HatInfo.VisualSet xSet, bool bUp, bool bRight, bool bDown, bool bLeft)
 {
     xSet.abBehindCharacter[0] = bUp;
     xSet.abBehindCharacter[1] = bRight;
     xSet.abBehindCharacter[2] = bDown;
     xSet.abBehindCharacter[3] = bLeft;
 }
Пример #3
0
        // HatInfo extensions

        public static void SetUnderHair(this HatInfo.VisualSet xSet, bool bUp, bool bRight, bool bDown, bool bLeft)
        {
            xSet.abUnderHair[0] = bUp;
            xSet.abUnderHair[1] = bRight;
            xSet.abUnderHair[2] = bDown;
            xSet.abUnderHair[3] = bLeft;
        }
Пример #4
0
 public static void SetRenderOffsets(this HatInfo.VisualSet xSet, Vector2 v2Up, Vector2 v2Right, Vector2 v2Down, Vector2 v2Left)
 {
     if (v2Up != null)
     {
         xSet.av2RenderOffsets[0] = new Vector2(v2Up.X, v2Up.Y);
     }
     if (v2Right != null)
     {
         xSet.av2RenderOffsets[1] = new Vector2(v2Right.X, v2Right.Y);
     }
     if (v2Down != null)
     {
         xSet.av2RenderOffsets[2] = new Vector2(v2Down.X, v2Down.Y);
     }
     if (v2Left != null)
     {
         xSet.av2RenderOffsets[3] = new Vector2(v2Left.X, v2Left.Y);
     }
 }
Пример #5
0
 public static void SetObstructions(this HatInfo.VisualSet xSet, bool bTop, bool bSides, bool bBottom)
 {
     xSet.bObstructsTop    = bTop;
     xSet.bObstructsSides  = bSides;
     xSet.bObstructsBottom = bBottom;
 }