I am developing a game using GameplayKit, built on Entity Component Framework, and utilising GKStates.
I would like to know what is the best practice for the following:
I have a game entity, called Person. This person wanders the scene doing their own business. They are in WANDER GKState. If they bump into another person, they start chatting for example, or fighting...
My question is, where should I put the contact physics code? Should it be in the Person's OnContactBegin method or should it be placed in the WANDER GKState, inheriting a physics component that supports OnContact methods?
Either way works, but what is the cleanest or preferred method? Currently, the code is all in the Person entity but as more behaviours are add, the OnContact method is getting bigger and unruly and I'm beginning to think I should put the code in the various GKStates.
Any suggestions?