Terraria.ModLoader.NPCLoader.DrawHealthBar C# (CSharp) Method

DrawHealthBar() public static method

public static DrawHealthBar ( NPC npc, float &scale ) : bool
npc NPC
scale float
return bool
        public static bool DrawHealthBar(NPC npc, ref float scale)
        {
            Vector2 position = new Vector2(npc.position.X + npc.width / 2, npc.position.Y + npc.gfxOffY);
            if (Main.HealthBarDrawSettings == 1)
            {
                position.Y += npc.height + 10f + Main.NPCAddHeight(npc.whoAmI);
            }
            else if (Main.HealthBarDrawSettings == 2)
            {
                position.Y -= 24f + Main.NPCAddHeight(npc.whoAmI) / 2f;
            }
            foreach (var hook in HookDrawHealthBar)
            {
                bool? result = hook(npc, Main.HealthBarDrawSettings, ref scale, ref position);
                if (result.HasValue)
                {
                    if (result.Value)
                    {
                        DrawHealthBar(npc, position, scale);
                    }
                    return false;
                }
            }
            if (NPCLoader.IsModNPC(npc))
            {
                bool? result = npc.modNPC.DrawHealthBar(Main.HealthBarDrawSettings, ref scale, ref position);
                if (result.HasValue)
                {
                    if (result.Value)
                    {
                        DrawHealthBar(npc, position, scale);
                    }
                    return false;
                }
            }
            return true;
        }

Same methods

NPCLoader::DrawHealthBar ( NPC npc, Vector2 position, float scale ) : void