Probably the root cause of UPDATE- RPG Current Dependencies & My version of Suspicion + QUESTION
So, the easier way to observe this is to set the suspicion time to a short time, e.g., 1 second.
The expectation would be that after enemy lost sight of the player, they stop and stand there for 1 second, and then walk back to their guard position.
During test you can easily see that they spend way less than 1 second though.
Changing it to, say, 0.5 second, and you might see no time spending waiting at all. Explanation below.
Root cause is that when enemy lost sight of the player and the timeSinceLastSawPlayer started ticking, they’re still walking towards the position they last saw the player.
Here we have two cases:
Case 1: It’s not intended. Enemy should stop immediately when they lose sight of the player.
Then our current Cancel() implementation for Fighter is wrong. We merely set/reset the trigger for attack, however, during chasing, enemy is already in Locomotion, so the triggers for stopping the attack doesn’t affect their behavior. Since our Attack action is actually a hybrid of Move and actual hitting (which I honestly think is a bad smell), our current way to stop attack only stops the latter half, and not the first moving part. Fix is to explicitly call Mover.Stop() as well. (Need to note the distinction between “cancel” the move from action scheduler and out right “stop”-ping the movement directly, although they functionally work exactly the same. I think the abstraction here is a bit messy)
Case 2: It’s intended. Enemy should walk to the position they last saw player, and then start waiting.
Then the update time part is wrong. The suspicion time should only start ticking if the enemy already reaches the position they last saw player and start standing still. In this case, what’s the best way to determine where / how to start the timer, though?