Example #1
0
 public IEnumerator TakeDamage(Vector2 gutDirection)
 {
     health--;
     if (health > 0)
     {
         gutValue = 0;
     }
     guts = Instantiate(Resources.Load(gutSplosions[6]), transform.position, Quaternion.identity) as GameObject;
     guts.gameObject.GetComponent <Rigidbody2D>().velocity = new Vector2(gutDirection.x * .3f, 5f);
     StartCoroutine(guts.GetComponent <GutSplosion> ().GenerateGuts(gutValue));
     if (health < 1)
     {
         StartCoroutine(balloonBasketScript.SlowTime(.1f, .5f));
         wavesScript.currentWaveBirdsStillAlive[birdType]--;
         StartCoroutine(wavesScript.CheckBirds());
         if (summonCrows)
         {
             StartCoroutine(summonTheCrowsScript.Murder());
         }
         Destroy(gameObject);
     }
     yield return(null);
 }