I got “stuck” on a problem.
I have player units which can pass through all the closed doors (They open when getting near).
Problem is the enemies. If doors are closed they should look for a better route (if there is any open one), otherwise go on the route of locked doors (And i will stop them as soon as they get in contact with the doors.
Tagging those “doors” would be nice but the best i could do was add penalty for the two tiles around the door and the character goes “around” as expected. The problem is that i have blocked the other doors (i tagged it with “problem” on the picture) so the player goes all the way around to get to the position (even tho he should enter thru the door but i blocked it with my method)
Somehow making the doors have higher penalty instead of those 2 tiles would fix all the problems.
firstTile.Tag = 3; (labeled with 1 on the picture)
secondTile.Tag = 3 (labeled with 2 on the picture)
EDIT: this is a 2d project
EDIT2: i might have written a bit wrong, problem tile is not “blocked” but the one below it (labeled with 1) as i didn’t know how to tag it better and this just doesn’t work
Might not be a deal breaker as i might still make them just go for shortest route thru the doors (And whack them on the way but if there is something for this might be cool :-))