<commit_before>using UnityEngine;
using System.Collections;

public class EnnemisMain : MonoBehaviour {
	public float HP ;
	public float damage;
	public float speed;
	public GameObject tree;
	[HideInInspector]public bool isAlive = true;
	[HideInInspector]public Animator animator;
	[HideInInspector]public AudioSource audioSource;

	public AudioClip deathSound;

	
	public EnnemisMain()
	{
		//Init closest tree
		tree = findClosestTree();

		HP = 100;
		damage = 10;
		speed = 10;
		isAlive = true;
		animator = animator;
	}
	// Use this for initialization
	void Start()
	{

	}
	// Update is called once per frame
	void Update () {
		
	}
	public void takeDamage(float damage)
	{
		HP -= damage;
		if (HP <= 0 && isAlive) 
		{
			StartCoroutine(setDestroy());
		}
		Debug.Log ("enemy as : "+ HP+" HP");
	}
	IEnumerator setDestroy()
	{
		isAlive = false;
		audioSource.PlayOneShot (deathSound);
		//ici jouer les animations de mort avant la destruction 
		animator.SetBool ("canDie", true);
		yield return new WaitForEndOfFrame ();
		yield return new WaitForSeconds (3);
		Destroy(gameObject);
		yield return 0;
	}

	//Retrun the closest tree
	private GameObject findClosestTree() {
		GameObject[] gos;
		gos = GameObject.FindGameObjectsWithTag("Tree");
		GameObject closest = null;
		float distance = Mathf.Infinity;
		Vector3 position = transform.position;
		foreach (GameObject go in gos) {
			Vector3 diff = go.transform.position - position;
			float curDistance = diff.sqrMagnitude;<commit_msg>Enemies<commit_after>using UnityEngine;
using System.Collections;

public class EnnemisMain : MonoBehaviour {
	public float HP ;
	public float damage;
	public float speed;
	public GameObject tree;
	[HideInInspector]public bool isAlive = true;
	[HideInInspector]public Animator animator;
	[HideInInspector]public AudioSource audioSource;

	public AudioClip deathSound;

	
	public EnnemisMain()
	{

		HP = 100;
		damage = 10;
		speed = 100;
		isAlive = true;
		animator = animator;
	}
	// Use this for initialization
	void Start()
	{
		//Init closest tree
		tree = findClosestTree();
	}
	// Update is called once per frame
	void Update () {
		
	}
	public void takeDamage(float damage)
	{
		HP -= damage;
		if (HP <= 0 && isAlive) 
		{
			StartCoroutine(setDestroy());
		}
		Debug.Log ("enemy as : "+ HP+" HP");
	}
	IEnumerator setDestroy()
	{
		isAlive = false;
		audioSource.PlayOneShot (deathSound);
		//ici jouer les animations de mort avant la destruction 
		animator.SetBool ("canDie", true);
		yield return new WaitForEndOfFrame ();
		yield return new WaitForSeconds (3);
		Destroy(gameObject);
		yield return 0;
	}

	//Retrun the closest tree
	public GameObject findClosestTree() {
		GameObject[] gos;
		gos = GameObject.FindGameObjectsWithTag("Tree");
		GameObject closest = null;
		float distance = Mathf.Infinity;
		Vector3 position = transform.position;
		foreach (GameObject go in gos) {
			Vector3 diff = go.transform.position - position;
			float curDistance = diff.sqrMagnitude;
{'fraction_non_alphanumeric': 0.09969889595182335, 'fraction_numerical': 0.008364001338240215, 'mean_word_length': 3.901639344262295, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1335597', 'n_tokens_mistral': 1083, 'n_tokens_neox': 973, 'n_words': 285}