Open agluszak opened 5 years ago
https://github.com/amethyst/evoli/blob/2e3b15965b31178e266dc1df3923c275b6afab60/src/components/creatures.rs#L18
Why is CreatureType defined to be a String instead of an enum? An enum would be more typesafe. As far as I can see, it's only used for an enum-like comparison here: https://github.com/amethyst/evoli/blob/2e3b15965b31178e266dc1df3923c275b6afab60/src/systems/spawner.rs#L105
The reason for this is that this way we can keep adding more creatures without modifying the code at all. All you need is to define a prefab with a Named component.
Named
https://github.com/amethyst/evoli/blob/2e3b15965b31178e266dc1df3923c275b6afab60/src/components/creatures.rs#L18
Why is CreatureType defined to be a String instead of an enum? An enum would be more typesafe. As far as I can see, it's only used for an enum-like comparison here: https://github.com/amethyst/evoli/blob/2e3b15965b31178e266dc1df3923c275b6afab60/src/systems/spawner.rs#L105