This repository aims to be a practical Unity3D application of the concepts expressed in the book "Design Patterns: Elements of Reusable Object-Oriented Software". The repository is an open to improvements exercise and is not intended to be exhaustive. Further patterns will be implemented in the future. Each pattern is implemented in a different Unity scene with a demo example.
- Abstract Factory Pattern (Creational);
- Factory Method Pattern (Creational);
- Singleton Pattern (Creational);
- Command Pattern (Behavioral);
- Observer Pattern (Behavioral);
- State Pattern (Behavioral);
- Strategy Pattern (Behavioral)
- Composition over inheritance.
Provide an interface for creating families of related or dependent objects without their concrete classes.
AbstractFactoryDemo.mp4
Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
See Composition over Inheritance Structure section.
Ensure a class only has one instance, and provide a global point of access to it.
See Command Pattern Structure section.
Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
CommandDemo.mp4
Define a one-to-many dependency between objects so that when one object state, all its dependents are notified and updated automatically.
ObserverDemo.mp4
Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
StateDemo.mp4
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
StrategyDemo.mp4
Building flexible and maintainable software by favoring the assembly of smaller, specialized components over rigidly inheriting behavior from complex parent classes.
ObjectCompositionDemo.mp4
- https://assetstore.unity.com/packages/2d/textures-materials/sky/skybox-series-free-103633
- https://assetstore.unity.com/packages/3d/props/tools/dice-d6-game-ready-pbr-200151#asset_quality
- https://assetstore.unity.com/packages/3d/props/low-poly-chess-pack-50405
- https://assetstore.unity.com/packages/3d/characters/animals/5-animated-voxel-animals-145754
- https://assetstore.unity.com/packages/3d/characters/animals/fantasy-bee-135487
- https://assetstore.unity.com/packages/3d/characters/toony-tiny-people-demo-113188)https://assetstore.unity.com/packages/2d/textures-materials/sky/skybox-series-free-103633
- https://assetstore.unity.com/packages/3d/props/tools/dice-d6-game-ready-pbr-200151#asset_quality
- https://assetstore.unity.com/packages/3d/props/low-poly-chess-pack-50405
- https://assetstore.unity.com/packages/3d/characters/animals/5-animated-voxel-animals-145754
- https://assetstore.unity.com/packages/3d/characters/animals/fantasy-bee-135487
- https://assetstore.unity.com/packages/3d/characters/toony-tiny-people-demo-113188