Example #1
0
 //Take hit without knockback using OnTrigger events with knockback
 public void TakeHit(int power, Collider collider, BBKnockback knockback)
 {
     this.TakeHit(power, collider);
     if (this.controller != null && !gameObject.tag.Equals(BBSceneConstants.deadTag)) {
         this.knockback = knockback;
         this.knockback.Timer.Start();
     }
 }
Example #2
0
 //Call when knockback isn't null from within update
 private void TakeKnockback(BBKnockback knockback)
 {
     this.knockback.Timer.Update();
     if (this.knockback.Timer.Seconds < this.knockback.Seconds) {
         this.controller.Move(this.knockback.Direction * this.knockback.Magnitude * Time.deltaTime);
     } else {
         this.knockback = null;
     }
 }