Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
armin-nimra

how to make damage Indicator

Question

hi,I wanted to know that how can I create an damage Indicator in Unity 3D ?
I went very search, but I did not find anything!
If the code is so much better.

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
Posted (edited)
Please login or register to see this quote. Please login or register to see this code.

Hope thats enough to get you started and understand it... 

with this you should be able to do something like what you can see in cod.

 

Edited by Erarnitox
format the code too make readable
  • Like 2

Share this post


Link to post
Share on other sites

  • 0
Please login or register to see this quote.

hi,Can you add complete the script??

how to send direction damage to this??can i use ui image instead of texture?

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

1) just pass it as an argument to the method.

2) sure can but im still kinda stuck the the old GUI system just used to it 

3) for me to post a complete script i would have to know your project / what your damge script looks like  

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

yeah, you can call the method like that, just pass in this.transform.position as an additional argument, so you can reference it. 

like:

hit.gameObject.SendMessage("ApplyDamage", DamageValue, this.transform.position, SendMessageOptions.DontRequireReceiver);

(if you do singleplayer stuff and only want to damge the player i would suggest to call it by accessing the Component diectly tho.

So if you hit the tag player just playerDamageController.ApplyDamage(5, transform.position)) 

 

than on the gameObject that was hit you have to have a Component that implements ApplyDamage(int DamageValue, Vector3 DamagePosition) so something like this: 

 

public void ApplyDamage(int DamageValue, Vector3 Damageposition){

      this.indicatorTime = 2f

      //calculate Angle 

      this.adjustAngle = calculatedValue

      //apply damage stuff:

      this.health -= DamageValue

 

hope this helps ... i think this is simular to how it was manages in the fps-kit? If you use the fps-kit give me some time i was thinking about extending the fps kit once i find time to do it. 

I love OMAs work and it was a great learning resource for me as well but i think hes not interested in developing this further. 

So if i find the time i might ask him if i can extend it as kind of my way to give back to this community. 

 

Edited by Erarnitox
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...