UHUDText扣血效果插件的使用

导入【UGUI HUD Text v1.4.1.unitypackage】插件

将HUD预制物拖到项目中

扣血效果的代码

//参数:1、角色本身的transform,2、hp和-号组合
    HUDTextInfo info7 = new HUDTextInfo(角色.transform, string.Format("{1}{0}", 血量, "-"));
    info7.Color = Color.red;//颜色
    info7.Size = UnityEngine.Random.Range(50, 120);//字体大小
    info7.Speed = UnityEngine.Random.Range(0.2f, 1);
    info7.VerticalAceleration = UnityEngine.Random.Range(-2, 2f);
    info7.VerticalPositionOffset = 2f;
    info7.VerticalFactorScale = UnityEngine.Random.Range(1.2f, 10);
    info7.Side = (UnityEngine.Random.Range(0, 2) == 1) ? bl_Guidance.LeftDown : bl_Guidance.RightDown;
    info7.ExtraDelayTime = -1;
    info7.AnimationType = bl_HUDText.TextAnimationType.PingPong;
    info7.FadeSpeed = 200;
    info7.ExtraFloatSpeed = -11;
    //Send the information
    bl_UHTUtils.GetHUDText.NewText(info7);

为角色添加碰撞器

调整扣血canvas的zorder,使其显示在最前面

删除这个讨厌的东西

对,就是这个,删除掉

最终的效果

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
-------------------------------------------------- NGUI: HUD Text Copyright 漏 2012-2014 Tasharen Entertainment Version 1.11 http://www.tasharen.com/forum/index.php?topic=997.0 -------------------------------------------------- Thank you for buying NGUI HUD Text! This version of HUDText has been tested with NGUI 3.4.9 If you have NGUI 2.7.0 or earlier, delete the Examples and Scripts folders, then import the contents of the hudtext_ngui270.unitypackage instead. ---------------------------------------------- !! IMPORTANT NOTE !! ---------------------------------------------- Upon importing this package into a brand-new project, you will get compile errors unless that project already has NGUI present! You'll need to import NGUI as well. If you don't have NGUI, but still want to use HUDText, then I am guessing you didn't read the package's description! But... you can still use HUDText. Get in touch with me via support@tasharen.com and I will hook you up. ---------------------------------------------- Usage: 1. Attach the HUDText script to a game object underneath your UIRoot and set the font it should use. 2. To make it follow an object drawn with another camera, attach UIFollowTarget to the same object and set its target. 3. From code, use HUDText's Add() function to add new floating text entries. You can also tweak the splines on the HUDText script, changing the motion of the text as you see fit. Video: http://www.youtube.com/watch?v=diql3UP1KQM ---------------------------------------------- Example Usage: ---------------------------------------------- HUDText hudText = GetComponent<HUDText>(); // This will show damage of 123 in red, and the message will immediately start moving. hudText.Add(-123f, Color.red, 0f); // This will show "Hello World!" and make it stay on the screen for 1 second before moving hudText.Add("Hello World!", Color.white, 1f); // If you don't want your numeric damage values to be added up, pass them as a string instead: float myDamage = 123f; hudText.Add(myDamage.ToString(), Color.red, 1f); ---------------------------------------------- If you have any questions, suggestions, comments or feature requests, please drop by the forums, found here: http://www.tasharen.com/forum/index.php?topic=997.0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值