::Hey guys!
Im on part 4 of the tutorial, applying damage for melee weapons.
I have made my garlic animated, when i deal damage with it, the damage get aplied wrongly (like 100 times). i believe that its because of the animation that i did (maybe the animation resets the garlic damage cooldown?) i put a Debug.log on the GarlicBehaviour.cs and it get applied a LOT of times
protected override void OnTriggerEnter2D(Collider2D col)
{
if (col.CompareTag("Enemy") && !markedEnemies.Contains(col.gameObject))
{
EnemyStats enemy = col.GetComponent<EnemyStats>();
enemy.TakeDamage(currentDamage);
Debug.Log("damage done");
markedEnemies.Add(col.gameObject); //Mark the enemy
}
}
}
Debug.log(“damage done”) 94 times in less than a second
If thats the issue i think it is, is there some way to “ignore” the animation when i make the garlic do damage?
If thats not the actual issue, let me know!