I am trying to set up a top-down adventure game-type thing.
Player clicks a location and the character moves to it using pathfinding. If they tap or click an object or a different character, they move in front of that object/character and trigger an animation, dialogue, etc.
My issue is, I don't know a clean, best practices way to trigger a reaction only if the pathfinding is resolved and the character reaches their destination.
For example, if a player taps a hammer that is across the room. The hammer has a variable that is the X,Y coordinates. The player character uses path finding to move to those coordinates. While the character is moving over, they can tap somewhere else to change directions without consequence. But if they don't and the character reaches the hammer, an animation plays and they pick the hammer up.
What I was trying to do was have a global trigger to distinguish between the character performing an action vs simply moving, and then a variable that is a unique name for each action ('hammer'). So if you tap a blank area they can walk to the variable is set to walk, if they tap an interactive object the variables are set to action and a specific title for that action ('hammer').
So then if they reach the coordinates for that action, while global trigger is set to action and the unique name 'hammer' matches up, it disables player input for a second and triggers the right stuff for hammer.
None of this was particularly working for me, plus it already feels very complicated.
Does anyone have an experience with a project like this? I can try to post a project example later but so far the general path finding is the only thing thats really working.