First-Person-Controller-VeryHotShark
First-Person-Controller-VeryHotShark copied to clipboard
Add event Action or event Func where appropriate
This is just a suggestion. In my local branch I've added several events that are initialized as empty delegates. By adding these, it is easy to subscribe/unsubscribe to relevant events invoked by the FirstPersonController. In the following example I added events that will fire OnZoomIn and OnZoomOut from the CameraController class. I've done similar for OnJump, OnLand, OnBeginCrouch, OnEndCrouch, etc.
CameraController.cs additions:
Then any other MonoBehaviour can subscribe to the events in OnEnable, and unsubscribe in OnDisable like this:
Yes it a very good practice and way to structure a code :) can you somehow do a pull request so i can see other func and actions ?