Example #1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Bullet"))
     {
         if (playHitAnimation == null)
         {
             health--;
             healthBar.value = health;
             if (health <= 0)
             {
                 if (OnDeath != null)
                 {
                     OnDeath();
                 }
                 soundMod.PlayModClipLate(deathSound);
                 gameObject.SetActive(false);
             }
             else
             {
                 StartCoroutine(playHitAnimation = PlayHitAnimation());
                 soundMod.PlayModClip(hitSound);
             }
         }
     }
 }
Example #2
0
 private IEnumerator Fire()
 {
     for (int i = 0; i < (fireMode == FireMode.BURST ? 3 : 1); i++)
     {
         shooter.ShootBullet(movement.DirectionToPlayer);
         soundMod.PlayModClip(fireSound);
         bulletTimer = Random.Range(-.5f, .5f);
         yield return(new WaitForSeconds(.1f));
     }
 }