Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jun 19, 2012 at 01:32 AM by Wolfram for the following reason:

Was resolved without explaining how (or what the problem was)

This post has been wikified, any user with enough reputation can edit it.
avatar image
-1
Question by BloodyRayne89 · Jun 17, 2012 at 06:00 AM · c#burgzergarcade

Burgzergarcade tutorial

Hello uhm i am doing the Burgzergarcades tutorial for over like 2 weeks now and i want to change some of the specs for my vital script to be changed to height not the width cause my GUI.Texture is a circle.Its from the Burgzergarcade free assets.Heres my script:

using UnityEngine; using System.Collections;

 public class VitalBar : MonoBehaviour {
     public bool _isPlayerHealthBar;        //This boolean value tells us if this is the playerHealthBar or the mob healthbar
     
     private int _maxBarHeight;                //This is how large the vital bar can be if the target is at 100% health.
     private int _curBarHeight;                //This is the current height of the vital bar.
     private GUITexture _display;
 
     // Use this for initialization
     void Start () {
 //        _isPlayerHealthBar = true;
         
         _display = gameObject.GetComponent<GUITexture>();
         
          _maxBarHeight = (int)_display.pixelInset.width;
         
         OnEnable();
     }
     
     // Update is called once per frame
     void Update () {
     
     }
     
     //This method is called when the GameObject is enabled.
     public void OnEnable() {
         if(_isPlayerHealthBar)
             Messenger<int, int>.AddListener("player health update", OnChangeHealthBarSize);
         else
             Messenger<int, int>.AddListener("mob health update", OnChangeHealthBarSize);
     }
     
     //This method is called when the GameObject is disabled.
     public void OnDisable() {
           if(_isPlayerHealthBar)
               Messenger<int, int>.RemoveListener("player health update", OnChangeHealthBarSize);
         else
               Messenger<int, int>.RemoveListener("mob health update", OnChangeHealthBarSize);        
     }
     
     //This method will calculate the total size of the health bar in relation to the % to the health the target has left
     public void OnChangeHealthBarSize(int curHealth, int maxHealth) {
 //        Debug.Log("We heard an event: curHeal = " + curHealth + " - maxHealth = " + maxHealth);
         
         _curBarHeight = (int)((curHealth / (float)maxHealth) * _maxBarHeight);            //This calculates the current bar length base on the players health %.
         
         _display.pixelInset = new Rect(_display.pixelInset.x, _display.pixelInset.yMin, _curBarHeight, _display.pixelInset.height);
         
     }
     
     
     //Setting the healthBar to the player or mob
     public void SetPlayerHealthBar(bool b) {
         _isPlayerHealthBar = b;
     }
 }
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image BloodyRayne89 · Jun 17, 2012 at 10:54 AM 0
Share

Oh nvm i know wat to do now!

avatar image Wolfram · Jun 17, 2012 at 07:52 PM 0
Share

Besides being a script dump, you did not even ask a question.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Multiple Cars not working 1 Answer

How do I load customized characters into my next scene? 2 Answers

C# how to have a part of an object rotate while animation is being played 2 Answers

Set the position of GUIBox 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges