I did the enemy behaviours in the first prototype. I was happy with the resulting actions of all the enemies, but am disappointed that one of the behaviours was not shown in the final build of the level. I had tested the behaviour in the level before putting it up on the google drive, but obviously didn’t make the prefab idiot proof.
We weren’t using a Repo for this build and the behaviour could have been included in a level quite easily if that had been the case. As it was, I didn’t think that it wouldn’t have been that hard to include into the level. I was wrong.
I was trying to save code, by having one class handle all of the enemies’ behaviour. I used bools to indicate what type of enemy it was. In hindsight, I should have used 3 different classes, one for each enemy and had prefabs for each one. Then it would have been a simple matter to drop and drag the prefabs into the level, with only the moving of the switch / trigger and the component could look after itself.
The thing I appreciated the most about the design, was that the trigger destroyed itself after spawning the enemies. The behaviours of the enemies was not too challenging to produce although the hit boxes where a bit of a drama. Each enemy had a hit box over its head that the player had to land on. While this did happen, unfortunately, the enemy caused the player to also record a hit against his health. I can’t work it out as the enemy was supposed to be destroyed when the hit box was triggered by the player. This worked most of the time, but thre was an intermittent problem where the player would also take a hit. The only thing I can think of, is than the player hit right at the junction of the two boxes.
Steve suggested that there was an option to measure the players vertical momentum to trigger the kill box, but in the short time we had, I couldn’t get it to work. I think that if I was to implement this code .. probably measuring the Vector3.y.magnitude <0 and make the kill box the same size as the enemies’ hit box, leaving a larger overlap at the top, it probably would have worked.
All in all, it was a learning experience. I can do better, I think.