美文网首页
UnityTips HealthBar

UnityTips HealthBar

作者: RichMartin | 来源:发表于2018-12-28 10:44 被阅读8次
public void UpdateHealthBar ()
    {
        // Set the health bar's colour to proportion of the way between green and red based on the player's health.
        healthBar.material.color = Color.Lerp(Color.green, Color.red, 1 - health * 0.01f);

        // Set the scale of the health bar to be proportional to the player's health.
        healthBar.transform.localScale = new Vector3(healthScale.x * health * 0.01f, 1, 1);
    }

相关文章

  • UnityTips HealthBar

  • UnityTips ScriptTemplates 位置

    一个Unity小技巧,不知道各位是否已经厌倦了创建新的cs脚本时默认的模板,其实我们可以方便的自己定义cs的模板。...

  • UnityTips 之CacheServer

    一、CacheServer是什么? CacheServer是Unity提供的一个高速缓存服务器,用于存储导入到项目...

  • UnityTips 之 PackageManager

    简介: unity在2018版本就已经有 PackageManager,来管理引擎的功能插件了,有了这个东西,我们...

  • UnityTips 之 色板

    unity 版本 2018.4.2f1简单介绍一下unity色板的两个实用小功能打开一个unity的基础颜色面板会...

  • UnityTips 之 选择集

    unity 版本 2018.4.2f1 重复选取物体,劳神伤体 相信在工作会遇到这样一个问题,比如场景,要修改一批...

  • UnityTips 之 颜色配置

    简介:可能大家有修改UNTIY一些配色的需求,下面给大家介绍一下UNITY从哪里可以调整引擎编辑器的部分颜色。版本...

  • UnityTips 之 显示模式

    简介: unity 的scene窗口为我们提供了多种显示模式,官方的全局光照部分只讲了一部分,这里做了补全。我们来...

  • UnityTips 之 Prefab 编辑

    简介: 最近在鼓捣2021的时候注意到了unity的prefab在场景中编辑有了新的特性,作者是从2019越级到2...

  • UnityTips 之 参数预设功能

    简介:大家在使用 unity 调节组件参数的时候经常会遇到这种情况,今天感觉还可以,过了两天老板说不合适缺少一些微...

网友评论

      本文标题:UnityTips HealthBar

      本文链接:https://www.haomeiwen.com/subject/fphslqtx.html