设置HP条UI

概述

设置常见的生命值条,

实现过程

设置UI/image作为形状

设置UI/Image作为背景

设置UI/image(healthfill)作为填充图片,层数低于背景

设置heathfill的imagetype为filled

fillmethod为horizontal

csharp 复制代码
 [SerializeField] private Image healthFill;
 public void AddHealth(int healAmount)
    {
        health += healAmount;
        if (health > maxHealth)
            health = maxHealth;
        healthFill.fillAmount = health / maxHealth;
    }
相关推荐
星释3 小时前
鸿蒙智能体开发实战:27.Skill 测试、发布与管理
ui·华为·log4j·harmonyos·鸿蒙·智能体
anling_li3 小时前
《图片华容道》一、背景设置使用指南
ui·华为·harmonyos
在书中成长4 小时前
HarmonyOS 小游戏《对战五子棋》开发第34篇 - ArkTS中复用UI的方法
ui·harmonyos
爸爸6194 小时前
鸿蒙实战:@State 本地状态与 UI 刷新
ui·华为·harmonyos·鸿蒙系统
酷酷的身影6 小时前
Managers/APConfigManager.cs
开发语言·ui·c#
精神底层1 天前
拒绝 UI 卡死!我用 CSnakes 实时拦截 Python 训练流,在 WPF 中重构了 ScottPlot 5 高性能 AI 看板
python·ui·wpf
在书中成长1 天前
HarmonyOS 小游戏《对战五子棋》开发第27篇 - 模式选择与UI布局
ui·harmonyos
不爱记笔记1 天前
GPT-5.6 Sol 真实项目实测!Bug修复、UI重构与帆船游戏复刻
人工智能·gpt·ui·chatgpt·bug·openai
前端H2 天前
生成式 UI 实战:AI 如何重塑前端界面
前端·人工智能·ui
全栈开发圈2 天前
新书速览|ComfyUI工作流赋能Photoshop
ui·photoshop