using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Leave : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        gameObject.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Static;
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void Triggered()
    {
        gameObject.transform.Find("ClickCollider").gameObject.SetActive(false);
        LeanTween.color(gameObject, Color.black, 1.0f).setOnComplete(delegate() {
            gameObject.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;
            gameObject.GetComponent<Rigidbody2D>().WakeUp();
        });
        gameObject.GetComponent<AudioSource>().Play();

        LeanTween.scale(gameObject, transform.localScale * 0.9f, 1.0f);
    }
}
