Example #1
0
 //  On skill key press, conjur a fireball and send it to target location
 //  TyNote: Create a fireball unit and set destination to target location (not homing). Dies on first collision or at end of path.
 //  TyDo: Fireball has a life timer
 //  TyDo: Make this a spell. For now, it's implemented as the autoattack
 public void fireball(ProjectileManager projMan, ContentManager content, GameObject target, Vector2 destination)
 {
     Fireball fireballTest = null;
     if (!fireballTimer.Enabled)
     {
         fireballTimer.Start();
         fireballTest = new Fireball(this.position,10, target, 1, 0);
         this.myArrow = fireballTest;
         Vector2 direction = MovementManager.getNormalizedVector(this.position, destination);
         fireballTest.setDestination(direction, destination);
         fireballTest.LoadContent(content);
         projMan.proj.Add(fireballTest);
         this.animateState = "attack";
         this.animateTime = 0;
     }
 }
Example #2
0
 //  The new attack code
 public override void Attack(GameObject target, ContentManager content, ProjectileManager projMan)
 {
     //if (!rapidFireTimer.Enabled)
     //{
     //    specialAttack = false;
     //    attackSpeed = 180;
     //}
     attackSound(content);
     Vector2 corrected = Vector2.Add(position, new Vector2(16, 16));
     Projectile projectile = new Arrow(corrected, 100, target, 100, 0);
     myArrow = projectile;
     Vector2 direction = MovementManager.getNormalizedVector(projectile.position, target.position);
     projectile.setDestination(direction, target.position);
     projectile.LoadContent(content);
     projMan.proj.Add(projectile);
     this.animateState = "attack";
     this.animateTime = 0;
 }