Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Enemy : MonoBehaviour
  5. {
  6. public float health;
  7.  
  8. // Use this for initialization
  9. void Start ()
  10. {
  11. }
  12.  
  13. // Update is called once per frame
  14. void Update ()
  15. {
  16.  
  17. }
  18.  
  19.  
  20. void onCollisionEnter2D(Collision2D coll)
  21. {
  22. if(coll.gameObject.tag == "Bullet")
  23. {
  24.  
  25. health--;
  26. if (health <= 0)
  27. Destroy(gameObject);
  28.  
  29.  
  30. }
  31.  
  32. if(coll.gameObject.tag == "??")
  33. {
  34.  
  35. health--;
  36. if (health <= 0)
  37. Destroy(gameObject);
  38.  
  39.  
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement