
At the top, it references the stats from the Character Stat script, so it will be using those stats. As well as a boolean for moving, to state whether the character is moving or not, true or false. Next it references the the NavMeshAgent as nAgent, so it is easier to type. Finally, there is the two different positioning utilising Vector3.
The next part is about making the decisions, since it is a turn based game. There are two more booleans, stating whether the character has either active and if it has made a decision.
Then it references the material which will be applied when the decision is made.

This is what will be called at the start of the game, which is the position of the characters, the character stats and the NavMeshAgent. Nothing to complex.

Every frame, the game will update and check whether these things are true or not. So, the first thing it will check is whether the character is active or not. If it is, it moves on and checks whether it is not moving. If it is not moving, then the player will be given the option to target the character they want to move. If they are moving, they they will not be able to.

So, to actually target a character is this part of the code. A raycast will be sent from the camera. It will then use the mouse position to see where it is on the screen. If the player presses mouse button on top of a character, then it will call HandleInteraction.

This is the HandleInteraction part. It describes what happens when the player selects a character. So, when they do click on a character, the switch statement activates and goes through the case. The next part is pretty much, when the NavMesh is is clicked on again, it will select that position. It will then say to move to said position. Then the material for decision made is called, and applies it to the character. This will then turn the haveDecision boolean true. Once it is all done, it breaks, ends it.
The part in green is to check whether the area which the player clicks is within the maxMove stat for the character. For this version, it is in green just so we can test the gameplay.

This section is to say what happens when the player clicks on an area which is outside the area of the maxMove stat. So, if the player does click outside the area, it will change the isMoving stat to false, the character will not move and reset its path to nothing. Easy tings.

The final part of the character movement script! All it says is, if the isMoving boolean is true, then the nAgent will set the destination and move to the selected position.

A new variable! A float to indicate the total distance.

The only change here is that there is now a restriction on the movement, so they can only move the distance that is provided. As well as, the player can only click on a point that is within the area of movement.

Here is where the float variable is being used. It is being used to indicate how far the distance between the original position and the end position is.