Production of Ngui-enhanced blood strips (Healthbar) in Unity3d

Source: Internet
Author: User

A special style of blood bar is needed for the project. The description is as follows:

1. Normal color is red. After being hurt, the amount of blood that will be deducted is dark (dark red), and has the effect of falling animation;

2. After the shield effect, add a portion of the amount of blood, the additional part is white, the shield effect disappears after the portion of the blood loss;

3. When the shield effect is damaged, the white blood amount is deducted first. When the white blood quantity is insufficient, the remainder is deducted from the red blood volume;

4. The white blood amount of the deduction effect is turned gray and has a downward animation effect;

4. When the effect of the shield, if the white blood will be added to the total blood bar "Overflow", the new calculation of the percentage of the blood bar;

5. When poisoning, the corresponding amount of blood (according to the priority of injury to the blood, that is, the first deduction of the shield, then deducted from normal) into purple. The purple blood quantity has the decreasing animation;

6. If the poisoning is injured, do not deduct the amount of purple blood (in fact, the portion has been deducted, but there is a buffer time), but the red or white part;

7. If the poison is affected by the shield effect?

When making ordinary blood strips, we usually use UISlider.

But here is the effect of shielding and poisoning, obviously not enough with UISlider. My first thought is to use multiple blood strips superimposed together, to distinguish between normal blood bar, poison blood bar, shield blood bar. But how to solve the blood-losing effect?

If it's just a drop animation, that's a good solution, but it will darken first, which is obviously a slider.

So I brainwave thought: a blood bar, multiple uislider! We can write a custom blood bar that contains the normal amount of blood, the poison value, the shield value, and the corresponding state attribute.

After practice, my idea is true indeed. First look at the following:

Production of Ngui-enhanced blood strips (Healthbar) in Unity3d

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.