Exemple #1
0
 /// <summary>
 /// Returns the texture that the given bar is using. If it does not have a custom one, it returns the vanilla texture
 /// </summary>
 /// <param name="bossBar">The ModBossBar</param>
 /// <returns>Its texture, or the vanilla texture</returns>
 public static Asset <Texture2D> GetTexture(ModBossBar bossBar)
 {
     if (!bossBarTextures.TryGetValue(bossBar.index, out Asset <Texture2D> texture))
     {
         texture = VanillaBossBarTexture;
     }
     return(texture);
 }
Exemple #2
0
 /// <summary>
 /// Gets the ModBossBar associated with this NPC
 /// </summary>
 /// <param name="npc">The NPC</param>
 /// <param name="value">When this method returns, contains the ModBossBar associated with the specified NPC</param>
 /// <returns><see langword="true"/> if a ModBossBar is assigned to it; otherwise, <see langword="false"/>.</returns>
 public static bool NpcToBossBar(NPC npc, out ModBossBar value)
 {
     value = null;
     if (npc.BossBar is ModBossBar bossBar)
     {
         value = bossBar;
     }
     return(value != null);
 }
Exemple #3
0
        internal static void AddBossBar(ModBossBar bossBar)
        {
            bossBar.index = bossBars.Count;
            bossBars.Add(bossBar);
            ModTypeLookup <ModBossBar> .Register(bossBar);

            //Texture is optional
            if (ModContent.TextureExists(bossBar.Texture))
            {
                bossBarTextures[bossBar.index] = ModContent.GetTexture(bossBar.Texture);
            }
        }