Hi,
So I'm working on a small web-based game (with a rust backend and websockets) and I am having some issue doing a clean design (well, I have one that would work in an OOP language).
Basically, I've got a bunch of units, and those units might fire projectiles. For now, I have only one type of unit, but I wanted to implement a more generic form of my projectile logic (to avoid refactoring all of it later).
In OOP, I would have simply an abstract class Projectile, with a bunch of attributes common to all children (damage, coordinates, speed, id...). And then a bunch of methods that might (or might not) be specific for each children ( canHitAllies(), getBoudingBox() etc).
Is the only way to rethink this design in rust to create a trait ProjectileTrait which I'll reimplement for each Projectile struct ? While it would work (with a bunch of Box everywhere, but I can live with that), I'll have to basically implement most of my attributes into getters because I can't link my attributes with my data type.
What are your thoughts on this ? Am I too stuck with the OO approach ?