设置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;
    }
相关推荐
星栈独行1 小时前
用 Rust + Makepad 做一个 JSON 查看器:从零到能用的全过程
开发语言·程序人生·ui·rust·json
xiami_world21 小时前
2026年UI/UX设计工具私有化部署方案深度解析
人工智能·ui·ai·产品经理·ux
川石课堂软件测试1 天前
UI自动化测试|XPath元素定位实践
功能测试·测试工具·jmeter·microsoft·ui·postman·harmonyos
川石课堂软件测试1 天前
UI自动化测试|CSS元素定位实践
css·测试工具·ui·fiddler·单元测试·appium·harmonyos
星辰徐哥1 天前
Spring Boot 数据导入导出与报表生成
spring boot·后端·ui
for_ever_love__2 天前
UI学习:UICollectionView瀑布流
学习·ui·ios·objective-c·cocoa
xiaobai1782 天前
pytest+playwright实现UI自动化(4)-上夹具fixture
ui·自动化·pytest·playwright
为何创造硅基生物2 天前
LVGL 妙用 LV_OBJ_FLAG_FLOATING
ui
ANnianStriver2 天前
PetLumina 04 — 管理后台 UI 全面升级
java·ui·ai编程
ANnianStriver2 天前
PetLumina 05 — App 端 UI 效果应用
java·ui·ai编程