Small refactor of the interaction system. #1261
Labels
Difficulty: medium 🥼
For those that already have some understanding of the code base.
Feature
A new system or other feature.
Interactions
Tasks specific to the interaction system or specific interactions.
Summary
The Interaction class implementing IInteraction is more trouble than help. First of all, it introduces another layer of inheritance, it doesn't implement anything, or it does it without real use. All it does is "hiding" some methods from things that inherits from it, but those methods will often be used and then throw a NotImplementedException(). The compiler doesn't complain because Interaction still provides an implementation, but if it's just to throw an exception it probably should just not exist.
The issue is that IInteraction contains more than it should. Some methods are useless for instant interactions, such as update and cancel. "ClientInteraction" are not occuring that often too and could have their own interface.
So divide IInteraction in three interface :
Remove class Interaction, and have every interaction implementing the interface directly.
Some script like interaction controller relies on IInteraction being full, it'll be necessary to change those scripts as well, and to add some logic to check which interfaces are implemented.
DelayedInteraction is nice though, it implements what's generic and leaves abstract what it can't handle, forcing inheriting classes to implement them. We can leave it and use it.
The text was updated successfully, but these errors were encountered: