One of my favorite parts of roguelikes is when you accumulate powers over the course of a run, there's a tangible and visual difference in your character, or in our case, the train. At first, we didn't really intend for the train trinket's visual component to play a big role in the game, the train would just sort of appear with the different parts attached. When I first started, I had no experience working with UIs or Widgets, however, as I worked on the system more and more, we realized that my initial socket system for the train parts was actually super easy to keep expanding on, and people loved the visual flavor we were able to incorporate.
As we iterated on the system, it grew more and more robust with features. We added slots so you can have an absurd amount of hats, sticker slots that let you have a gold star, animations, and a whole lot more. This was a proof of concept for the theory.
Here's an example of what swapping train parts looks like.
To animate the train parts, we have them split into groups in the widget hierarchy, and then we can simply animate the group in and out of frame.
With so many different possibilities of Train Cars and wide varieties in proportions, it was important to have a system in place that made it easy to test different configurations easily. It's honestly really fun just messing around with different pieces.