Advertisement
kasru

Minion Spell

Jan 24th, 2013
1,650
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 fireAt : Transform;
  5. var spellTransform : Transform;
  6. var rotationSpeed2 = 7;
  7. var moveSpeed2 = 10;
  8.  
  9. function Update () {
  10.  
  11.     fireAt = GameObject.FindWithTag("tower1").transform;
  12.  
  13.     spellTransform.rotation = Quaternion.Slerp(spellTransform.rotation,
  14.     Quaternion.LookRotation(fireAt.position - spellTransform.position), rotationSpeed2*Time.deltaTime);
  15.     spellTransform.position += spellTransform.forward * moveSpeed2 * Time.deltaTime;
  16.  
  17.     if(TowerScript.tower1health <= 0) {
  18.  
  19.         Destroy(this.gameObject);
  20.     }
  21. }
  22.  
  23. function OnTriggerEnter (col : Collider) {
  24.  
  25.     if(col.gameObject.tag == "tower1") {
  26.         TowerScript.tower1health -= 10;
  27.         Destroy(this.gameObject);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement