Esempio n. 1
0
 public void PlayerHit()
 {
     //Damage is done to the player when function is called
     if (health > 1)
     {
         FXAudioManager.FXAudio(3);
         health--;
         health_Amount.text = health.ToString();
     }
     else
     {
         if (ExplosionAnim)
         {
             Instantiate(ExplosionAnim, transform.position, Quaternion.identity);
         }
         Instantiate(FadeOut);
     }
 }
Esempio n. 2
0
    public IEnumerator Shoot()
    {
        mayShoot = false;

        //Spawns in the bullet
        Instantiate(bulletBullet, transform.position, transform.rotation);

        FXAudioManager.FXAudio(6);

        //If the player's damage is upgraded, the player will shoot 2 bullets instead of one
        if (damage > 1)
        {
            yield return(new WaitForSeconds(.4f));

            //Spawns in the bullet
            Instantiate(bulletBullet, transform.position, transform.rotation);
            FXAudioManager.FXAudio(6);
        }

        //Prevents you from shooting to rapid
        yield return(new WaitForSeconds(WaitToNextShot));

        mayShoot = true;
    }