SOLID Factory is a Unity2D Project which has been developed to test high-level programming concepts such as SOLID, DRY, Separation of Concern, Composition over Inheritance, Maximize Cohesion, Minimize Coupling, and Dependency Injection(via Exzenject) principles in Unity.
The project architecture is separated into two layers. The first layer is Core, which contains whole gameplay and systems implementations. The last layer is Simulation which is designed for simulating the Core layer.
Mentioned layers and their assets are available in the following paths:
for Core Layer : Assets/Scripts/Core
for Simulation Layer : Assets/Scripts/Simulation
Also, you can run the Simulation Scene. It is located under Assets/Scenes/Simulation
in project folders. If you hit play, the simulation system is going to add 12 scenes as additive. You can zoom in and out by clicking the frame that holds a scene. When you zoomed in on a scene, other scenes unload. The load and unload scene operations work as async. Thus significantly reduces the processing intensity.
Stable Tank with the lowest specs. Tanks cannot move around. However, they are only capable of detecting and tracking things.
Fastest tank kind. Mobile Tanks can move around quickly. However, they are only capable of detecting things and navigating around.
The Source is an entity to which we can apply five different behaviors with the Composition over Inheritance principle. There is possible to create 48 variant sources whose different sub-behaviors than the others. Also, it's possible to make that combination at runtime!
The most capable Tank kind. Heavy Tanks are slower than Mobile Tanks. However, there is the Placer Unit, which gives the ability to store and place entities. They are also capable of detecting things and navigating around.
Placeable Areas can be detectable by any Tank kind whose a Detector Unit. The Area executes its operation with the entity that has IPlaceable behavior. Also, the Area has two different placement types. The first one organizes received entities with specific animation. The last one places the entities where they've received without any action.
Conveyor Belts are only capable of carrying entities whose ITransportable behavior. Every received transportable entity keeps in Queue until the next iteration of the Conveyor Belt starts.
Sprayers are only capable of spraying entities which has IPlaceable behavior. Every received transportable entity keeps in Queue until the next iteration of Sprayer starts. The Circle is the default Sprayer's target area. It's easy to create new variations like Triangle, Square, etc. Also, the area radius is changeable via Inspector with the "radius" property.
Processor is only capable of upgrading entities' sub-behaviors whose IProcessable behavior. Every received processable entity keeps in Queue until the next iteration of the Processor starts. In the example, the Processor doesn't process the entity which doesn't have IProcessable behavior. That's why the entities are stuck in Processor's entry point.
Every individual component is processed as Node. It is a module whose Input, Process, and Output operations are implementations. Straight Machine searches for its child elements to find Nodes. Then, bind found nodes to each other such as the Singly Linked List approach.
The Loop Machine works pretty much the same as the Straight Machine. But the only difference is that the machine uses the Circular Linked List approach. In this way, it is possible to create cyclic machines.