﻿using UnityEngine;
using System.Collections;

public class Leaf : MonoBehaviour {

    private bool Alive = true;

    void Start()
    {
	}
	
    void Update()
    {
	}

    void OnCollisionEnter2D(Collision2D coll)
    {
        if (GameSetting.GameStart && Alive && coll.gameObject.tag == "Player")
        {
            Alive = false;
            if (GameSetting.isDashing || GameSetting.HulkMode || GameSetting.InvincibleMode)
            {
                GetComponent<Rigidbody2D>().isKinematic = false;
                GetComponent<PolygonCollider2D>().isTrigger = true;
            }
        }
    }

    //void OnCollisionEnter2D(Collision2D coll)
    //{
    //    if (coll.gameObject.tag == "Enemy")
    //        coll.gameObject.SendMessage("ApplyDamage", 10);

    //}
}
