Ejemplo n.º 1
0
 /// <summary>
 /// Damage the ship
 /// </summary>
 /// <param name="damage">Amount to damage the ship by</param>
 void DamageShip(object sender, BulletHitEventArgs e)
 {
     if (e.HitCollider == this.cCollider)
     {
         if (this.cHealth.ApplyDamage(e.ShotDamage) <= 0f)
         {
             this.DestroyShip();
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Hit by bullet (should only be triggered when active)
 /// </summary>
 /// <param name="sender">the bullet that hit this shield</param>
 /// <param name="e">the arguments describing the event</param>
 private void TakeHit(object sender, BulletHitEventArgs e)
 {
     if (e.HitCollider == this.collider && state == ShieldState.ACTIVE)
     {
         this.shieldHealthFloat -= e.ShotDamage;
         if (this.shieldHealthFloat <= 0f)
         {
             this.shieldHealthFloat = 0f;
             this.state             = ShieldState.REGENERATING;
             this.collider.enabled  = false;
             this.renderer.enabled  = false;
         }
     }
 }
Ejemplo n.º 3
0
 private void BulletManager_BulletHit(object i_Sender, BulletHitEventArgs i_EventArgs)
 {
     if (i_EventArgs.Target is IEnemy)
     {
         this.Score += (i_EventArgs.Target as IEnemy).Score;
     }
 }