Week 12:
Learning How To Use Unity Engine – Part 6:
Continuing on from last week, I shall now be working on the AI Behaviour for the Enemy NPCs. In order to do this, I started by creating a new “C# Script” I named “AI Behaviour” in the “Scripts” folder. I then found and edited the following script, which works in tandem with the “Health Bar” script I incorporated last week. The main aspect of this coding allows the “Zombie” Ai to move towards the “Player” using a rudimental piece of “Pathfinding” coding. As a result, the “Zombie” Ai will take the most direct path towards the “Player” and they will go around anything obstacles that happen to be in the way.
Once I was done with the script, I then saved it and dragged the “Zombie”. In the “Ai Behaviour (Script)”, I then changed and edited the following. “Player” > “Player (Transform)”, “Player” > “Player” >, “HM” > “HUD (HealthManager)” and “Z DAM” > “10”. with this I have managed to implement and create a few basic Ai Elements, in the form of Fuzzy Log (Health Bar), Pathfinding (Zombie Movement) and a Finite State Machine (Zombie Animator).


No comments:
Post a Comment