I would like to move my player with Keyboard/Joystick Input but also support "point and click" movement method so that the user may choose whether they want to move with keyboard button or clicking the mouse.
What I've done now is set it to Direct, but I've changed some logic in PlayerMovement.cs so if there is not keyboard input then it will use PointControlPlayer() instead:
if (KickStarter.playerInput.GetMoveKeys() == Vector2.zero) {
PointControlPlayer();
}
else {
DirectControlPlayer(false, KickStarter.playerInput.GetMoveKeys());
}
This does not quite work because player will not follow path, only stand in place when clicking with the mouse.
Any tips for combining Direct and PointAndClick methods? I understand a NavMesh and also bounding colliders will be necessary in the scene.
Comments
As before, you can get an API reference to the Manager field by right-clicking its label:
AC.KickStarter.settingsManager.movementMethod
You should be able to place a custom script in your scene that does this without modifying AC. That way you can also add things like code to stop the player when switching if need be:
AC.KickStarter.player.Halt ();
new Vector2 (Input.GetAxis ("Horizontal"), Input.GetAxis ("Vertical"));
If that works in place of your use of playerInput.GetMoveKeys(), you should be able to revert the PlayerInput script back to its original.