title: Add extra life HEART texture 2D
body: <p>I am working on 2D game.</p>
  
  <p>When player collides with <code>BOMBPrefab</code> lose 1 heart (initial 3 heart), if collides 3 times = GameOver.</p>
  
  <p>Thats is the code (works fine for BombPrefab):</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class Heart : MonoBehaviour {
    public Texture2D[] initialHeart;
    private int heart;
    private int many;
  
    // Use this for initialization
    void Start () {
      GetComponent&lt;GUITexture&gt;().texture = initialHeart[0];
      heart = initialHeart.Length;
    }
  
    // Update is called once per frame
    void Update () {}
  
    public bool TakeHeart()
    {
      if (heart &lt; 0) {
        return false;
      }
      if (many &lt; (heart - 1)) {
        many += 1;
        GetComponent&lt;GUITexture&gt; ().texture = initialHeart [many];
        return true;
      } else {
        return false;
      }
    }
  }
  </code></pre>
  
  <p>I have a second <code>HeartPrefab</code>, I want to check when player collides...  IF I have 3 hearts do nothing, IF have 1 or 2 hearts ADD extra heart.</p>
  
  <p>BombPrefab Scrip:</p>
  
  <pre><code>   using UnityEngine;
  using System.Collections;
  
  public class Bomb : MonoBehaviour
  {
  
  
      public AudioClip clipBomba;
  
      private Heart heart;
      private Gerenciador gerenciador;
  
      void Awake ()
      {
  
  
      }
  
      // Use this for initialization
      void Start ()
      {
          gerenciador = FindObjectOfType (typeof(Gerenciador)) as Gerenciador;
      }
  
      // Update is called once per frame
      void Update ()
      {
  
  
  
      }
  
      void OnCollisionEnter2D (Collision2D colisor)
      {
          if (colisor.gameObject.tag == "floor") {
  
              Destroy (gameObject, 2f);
  
          } else {
  
              if (colisor.gameObject.tag == "Bee") {
  
                  Som();
  
                  heart= GameObject.FindGameObjectWithTag ("Heart").GetComponent&lt;Vidas&gt; () as Vidas;
  
                  if (heart.TakeHeart ()) {
                      Destroy (gameObject);
  
                  } else {
  
                      gerenciador.GameOver ("GameOver");
  
                  }
              }
          }
      }
  
  
      void Som()
      {
  
          GetComponent&lt;AudioSource&gt; ().clip = clipBomb;
          AudioSource.PlayClipAtPoint (clipBomb, transform.position);
      }
  }
  </code></pre>