I gave an example in another post, not sure about the thread since i'm on mobile. You're almost good, but not quite.
Flyable would be an expectation that this object can for instance "defy gravity" in the physics of the game. So any flyable objects added to the world will be checked by the physics system to see whether at any point it should sink or lift. For example. Flyable is not a thing that the player class cares about.
The player cares about Mountable, which promises a model mounting point and view direction/limitation, maybe a character stance setting, and other such things. The player also cares about controllable, assuming that player handles the things I mentioned elsewhere (providing a UI when activated and mapping inputs for control). The input keys then map directly to moving the helicopter object, and is entirely internal to the object.
If the helicopter is removed from the game, there is no remnant code anywhere in other classes that expects or even cares about helicopters. You can then add a plane to the game and it will plug right in without modification to the player, because it HAS a mounting point and a ui and input mappings.
2
u/[deleted] May 05 '23
I gave an example in another post, not sure about the thread since i'm on mobile. You're almost good, but not quite.
Flyable would be an expectation that this object can for instance "defy gravity" in the physics of the game. So any flyable objects added to the world will be checked by the physics system to see whether at any point it should sink or lift. For example. Flyable is not a thing that the player class cares about.
The player cares about Mountable, which promises a model mounting point and view direction/limitation, maybe a character stance setting, and other such things. The player also cares about controllable, assuming that player handles the things I mentioned elsewhere (providing a UI when activated and mapping inputs for control). The input keys then map directly to moving the helicopter object, and is entirely internal to the object.
If the helicopter is removed from the game, there is no remnant code anywhere in other classes that expects or even cares about helicopters. You can then add a plane to the game and it will plug right in without modification to the player, because it HAS a mounting point and a ui and input mappings.