Every GameObject has a transform
As we learned earlier in this chapter, in the Entity-Component pattern section, every GameObject
will have a Transform
class as a member. The Transform
class will hold all the data and perform all the operations that are common to all GameObject
instances, plus a bit more. In a fuller game engine, the Transform
class would typically be small class, but we are going to cheat and make it quite big in order to incorporate some data and methods that wouldn't typically be part of Transform
.
We are doing it this way to stop the structure of our code from becoming even more complicated. While planning this book, it seemed that the structure of this project had already increased in complexity. Therefore, this class will be a kind of catch-all for common things that our component classes don't handle. You will notice that not all GameObject
instances will need all the functionality/data. This isn't a best practice, but it will serve as a stepping...