// Combat void attack() { // empeche l'ennemi de traverser le joueur agent.destination = transform.position; //Si pas de cooldown if (Time.time > attackTime) { Debug.Log("ATTACK"); // if (!waitForNextAnimation) // { animations.Play("Attack"); if (Target.gameObject.tag == ("Player")) { Player player = GameObject.Find("Player").GetComponent <Player>(); player.TakeDamage(TheDammage); } if (Target.gameObject.tag.Contains("Enemy")) { EnemyAi enemy = Target.gameObject.GetComponent <EnemyAi>(); enemy.ApplyDammage(TheDammage, Target.transform.position); } // } // Target.GetComponent<PlayerInventory>().ApplyDamage(TheDammage); //Debug.Log("L'ennemi a envoyé " + TheDammage + " points de dégâts"); attackTime = Time.time + attackRepeatTime; } }