Ejemplo n.º 1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Fish")
     {
         HookActive         = false;
         transform.position = new Vector3(StartX, StopHeight, 0f);
         Path.SetPosition(0, new Vector3(StartX, StopHeight, 0f));
         if (IsHooked == true)
         {
             Destroy(Hooked);
         }
         GM.MinusLife();
         SM.PlayFish();
     }
     else if (collision.gameObject.tag == "Trash")
     {
         if (IsHooked == false)
         {
             IsHooked = true;
             Hooked   = collision.gameObject;
             Hooked.GetComponent <Movement_Motor>().SetHooked();
         }
         SM.PlayTrash();
     }
     else if (collision.gameObject.tag == "Life")
     {
         GM.LifePickUp();
         Destroy(collision.gameObject);
         SM.PlayLifeGain();
     }
 }