Advertisement
kasru

Combat System

Jan 15th, 2013
6,385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //****** Donations are greatly appreciated.  ******
  2. //****** You can donate directly to Jesse through paypal at  https://www.paypal.me/JEtzler   ******
  3.  
  4. var enemyHealth : int = 100;
  5.  
  6. function Update () {
  7.  
  8.     if(this.enemyHealth <= 0) {
  9.         playerHealth.curXp += 10;
  10.         Destroy(this.gameObject);
  11.     }
  12. }
  13.  
  14.  
  15. function OnTriggerStay (col : Collider) {
  16.  
  17.     if(col.gameObject.tag == "attackArea") {
  18.  
  19.         if(Input.GetKeyDown("1")) {
  20.             this.enemyHealth -=100;
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement