using UnityEngine;
using System.Collections;

public class DeadlyToTouch : MonoBehaviour {

    private GameObject playerGO;

    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "Player")
        {
            if (GameController.Instance.LoseSong != null)
                iTween.Stab(gameObject, GameController.Instance.LoseSong, 0f);

            GetComponent<Collider2D>().enabled = false;
            transform.localScale *= 1.4f;
            ClockControl.Punch(0.5f);
            playerGO = col.gameObject;
            Invoke("FinishHim", 0.02f);
        }

    }

    private void FinishHim()
    {
        playerGO.GetComponent<ActorStatus>().TakeDamage(1);
    }
}
