using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.SceneManagement;

public class bossBalon : MonoBehaviour
{

   Animator anim;
   

   void Start()
   {
        anim=GetComponent<Animator>();
   }



   void Update()
    {
        if (Input.GetMouseButtonDown(0)) // Sol tıklama
        {
            Vector2 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(mousePosition, Vector2.zero);

            if (hit.collider != null && hit.collider.gameObject == gameObject)
            {
                
                StartCoroutine(patlat());
                
            }
        }
        
    }

    

    IEnumerator patlat()
    {
        anim.SetBool("patlat",true);
        yield return new WaitForSeconds(1.05f);
        Destroy(this.gameObject);
        balonSayac.kacTane++;
    }
}
