It's the end of day 16 and I'm finally finished with implementing guards! The feature has been three days in the making instead of the one I had hoped for and I've spent two or more hours a night instead of the regular one hour...
The guards will probably be one of the first upgrades players can purchase in the game's campaign mode though, so I hope the attention to detail is worth it and that this first upgrade impresses players.
To give you an idea of the amount of work that was involved, I had to:
- Draw each frame of animation for the guard peeking out of the doorway.
- Create an animation state machine in Unity with states for Cover, Peeking, Ready, Hiding.
- Create animations in Unity corresponding to the states.
- Code some fairly complex logic for showing the arm once fully in the Ready state and then rotating the arm into the aimed position.
- Code logic to allow guns to run out of ammo and be reloaded.
- Code logic for detecting enemies and only shooting when they are in range.
- Code logic for going back into cover when out of ammo to reload.
- Add cheat keys for testing.
- ... aaaand start on the enemy Soldier movement logic so that guards would have more targets to shoot at.
You can see the new stuff in action here (yes the enemy soldier logic is very broken - it's late):
Sas is busy working on a bomber and bunker health mechanic which I'm hoping will be ready soon so I can work on enemy soldiers a bit more. In the meantime I'll start building a user interface for spending points to buy upgrades.