﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using Amanotes.ContentReader;
public class TileController : MonoBehaviour
{
    public Vector3 spawnPosition;
    public ParticleSystem effectHit;
    public ParticleSystem effectPerfect;
    public NoteData noteData;

    public void DoDisable()
    {
        StartCoroutine(Disable());
    }

    public void PlayHitEffect(bool isPerfect = false)
    {
        if (isPerfect) effectPerfect.Play();
        transform.DOScale(1.2f, 0.8f).SetEase(Ease.OutElastic);
        effectHit.Play();
    }

    public void DoFadeIn(float time)
    {
        transform.DOMoveZ(spawnPosition.z, time);
    }

    IEnumerator Disable()
    {
        yield return new WaitForSeconds(1.5f);
        transform.DOKill();
        transform.localScale = new Vector3(1, 1, 1);
        effectHit.Stop();
        effectPerfect.Stop();
        gameObject.SetActive(false);
    }
}
