duck

duck

Aug 3rd, 2010
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //  ------ spell cast script ------
  2.  
  3. var spellVFX : BoltController;
  4. private var projectileStartOffset = Vector3(-0.1, 0.46, 0.2);
  5.  
  6.  
  7. function KeepDoing (currentTarget : Transform, targetController : AgentController) {
  8.  
  9.     // activate casting effects:
  10.     for (var i = 0; i < castingVFX.length; i ++) {
  11.         castingVFX[i].SetActiveRecursively(true);
  12.     }
  13.    
  14.     yield WaitForSeconds (1.0);
  15.    
  16.     // fire projectile
  17.     var pos = playerTransform.position;
  18.     pos += playerTransform.TransformPosition(projectileStartOffset);
  19.     var rot = playerTransform.rotation;
  20.     var newIceBolt : BoltController = Instantiate(spellVFX, pos, rot);
  21.     newIceBolt.FireAt( currentTarget, travelSpeed);
  22.    
  23.     // deactivate casting effects
  24.     for (var j : int = 0; j < castingVFX.length; j ++) {
  25.         castingVFX[j].SetActiveRecursively(false);
  26.     }
  27.    
  28.     yield WaitForSeconds (0.5);
  29.    
  30.     // finish up
  31.     targetController.Die();
  32.     canCast = true;
  33.     thisUIButton.controlIsEnabled = true;
  34.    
  35. }
Advertisement
Add Comment
Please, Sign In to add comment