I have now finished the Pathfinding for my Zombies, which navigate a Navigation Graph which is dynamically created as per the rooms used to create the map; in other words the NPCs can navigate any map created; of course isolated areas made will naturally be in-accessible.
I have decided through research such as here that a Navigation Graph is probably the best way for me to implement the AI's to path to the player, at least as far as getting around is concerned.
Furthermore this method of pathfinding as seen in the adjacent image should be easily to implement on a High-Level / Low-Level basis.
On the High level I plan for an AI to make a pathfinding check on a room by room basis to the player. When navigating through a room, I plan to have the NPC make a call to the node it reached and get the Vector3 Position of the next node for leaving the room by the desired exit (N,S,E,W).
This way I can have the NPCs only make a room path check every time the player changes rooms, and the NPCs also only path through the room they are in, and through transitions.
There is certainly room for optimization research, but not only is this a University Project I also believe in getting a system to work first, and then optimize the code.
The plan for AI right now is to write the various scripts and methods to have the network of nodes connect on runtime; as when a model is loaded from the pre-fabs in Unity, the public settings are saved, so being able to move from one node to another can be saved as a node object reference on each (and as is my plan) but for saving I will need to abstractly save the positions and rotations of the rooms, so I cannot save the connections between rooms.
The idea for this is on loading a map, each room's portal node (shown as a green sphere) will make a call to its adjacent room to get the position (if one exists) of the neighboring portal node, if none exists then the node becomes a non-portal node and can only be used for room navigation.
I have now coded a working shooting script of which when the bullet is created, is rotated to face the Vector3 position that the Raycasthit, as such the bullet moves straight to the point aimed at when fire was pressed.
I have also coded with this Ammo, featuring a current Magazine and reserve ammo that will run out and can be reloaded at any time, with as far as I have tested, no bugs.
Additionally, I have a simple Ammo Box script which searches inside a generate sphere collider for a gameObject with the tag player, of which if one exists tells it to Broadcast the message giveAmmo, which calls the method of the same name to give ammo.
All this started from my original shoot script which instantiated a bullet and gave it a push (addForce) which I then adapted to use a raycast to deal damage, after this I added a lineRenderer to use instead of the bullet model.
Once that was finished I then proceeded to make the bullet hit the point the ray hit.
As I said before I am doing a Project;
If any Videos don't work, you can view them at my Youtube Channel