Coding the component interfaces
Now we will code an interface to suit each of the components that will make up all the different game objects we have just coded the specifications for. We will not code a different interface for each different component type, rather we will code generic types that relate to them all. Allowing all the different types of update and graphics component to be used polymorphically in our code – as we did in the previous project.
Therefore, we will need an update component interface and a graphics component interface.
Tip
You can use copy & paste as you did in the previous section, just be sure to examine the code and understand it to avoid confusion later in the project.
Let's start with the graphics component.
GraphicsComponent
All graphics components will need to be able to do two things. This means they will need two methods. Note that the implementation of the actual components that implement these interfaces are free to add more methods- and some...