Previously, I shared how Sin sensed the player. Now I want to cover how Sin gets around. It’s fairly straight forward: I use a NavMesh and NavMeshAgent – which is all built into Unity (so my work is done). What’s not so simple is behavior. To imply behavior, I need Sin to patrol, respond to sounds, chase the player, and investigate last known locations.
To simplify things, I’ve given Sin only one target–aptly named “Sin Target”.

So–if the Sin can see the player, Sin Target’s position becomes equal to the player’s position. Now Sin appears to chase the player, when really, he’s just chasing the same target toward which he’s always moving.
But it’s also handy when dealing with Sin’s Patrols:
In every room there is an empty object named after the room it’s placed in. I’ve put these all in a list, kept on Sin. They’re separated by floor.


I’ve considered creating routes for Sin–but we’ll see if it’s needed.
Bonus topic: Sin Opens Doors
There are lots of doors that the player can open and close. We can’t have Sin just passing through like a ghost, even though…he is…But then, why not just have him walk through walls?
Anyway, I created a simple script to allow Sin to open doors when he tries to pass through them.

Next–I’ll share Sin’s Brain.
No comments:
Post a Comment