In basic it is pretty easy.
First you will need to make the script that stores the health and can be accessed by another scripts, so:
Add this to the enemy and name the script enemyHealth:
Then we would want to create a new script that hurts the enemy:
Put this on the camera:
This is untested so there may be errors.
go check the fps tutorial. it already features such a simple AI, modify health and bullet damage values to get to your 20 hits.
answered May 09 '11 at 06:47 PM
I am having this same type of issue and the fps tutorial sounds like it no longer works with the new unity. Is there somewhere else to try and look? Or if someone is just willing to listen to my new issue and help me out that would be cool too.
answered Feb 17 '12 at 07:24 PM