Can OnTriggerEnter2D trigger again once triggered?
So I have this code:
void OnTriggerEnter2D (Collider2D other)
{
if (other.tag == "Arena") {
wallTrigger = false;
}
if (other.tag == "GamerWeapon") {
var magnitude = 16000;
var force = transform.position - other.transform.position;
force.Normalize ();
GetComponent<Rigidbody2D> ().AddForce (-force * magnitude);
attacked = true;
}
}
Now this piece of code is on my enemy - and it is constantly inside a arena-like circle collider which functions as a trigger - i have done this in order to restrain its movements inside this circle.
Now inside this circle i also have my player and when he does an attack, he attacks with a sword which only has a box cillder marked as "is trigger"...so technically - when my enemy is in his reach and he attacks and hits it, the code should trigger, right?
Or can it be that the OnTriggerEnter2D function is somehow blocked because it has already been triggered since the enemy is inside the arena-circle?
Don't really know what the problem could be...the logic should work :/
Greatly appreciate any help! :)
Comment