CinematicControlRemover - Small Bug with Mover.Move()?

So i followed the lesson and everything seems to be working fine. But there’s one small problem - if I click on a guard, my character will still try to move to the guards position. I tried to disable the Fighter componenet as well, but it doesn’t seem to change anything since the player was still told to go to a location via the Mover Componenet’s’ Move() method, and therefore the ActionScheduler isn’t catching/stopping it.

Currently, I’m fixing this by setting
player.GetComponent().SetDestination(player.transform.position);
to make the player’s current position the destination, and to stop movement. This feels a little weird though and it’s yet another dependancy that CinematicCojtrolRemover needs. Is this ok? Or is there a better way?

Ideally, this should be done via the interface in the ActionScheduler…

I’m not sure if we’ve included this yet, but our Mover Script should have a method
Stop();

void Stop()
{
   GetComponent<NavMeshAgent>().isStopped=true;
}

void Cancel()
{
    Stop();
}

Then Fighter should include

GetComponent<Mover>().Stop(); 

in it’s Cancel() method.

This methodology also requires that when we set a destination with Mover.MoveTo() (which is also called by StartMoveAction(), we need to include the line

GetComponent<NavMeshAgent>().isStopped=false;
1 Like

That makes sense, thank you!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms