Design Patterns Code for Unity Games
Classes and utilities that are common to many games.
Provides common interface for all objects.
Example: Go() is a common interface for game objects that need to be kickstarted in some way.
Simple class. Stable.
Spawns a game object inside a 2D circle determined by its radius. The spawn area extends from the spawner’s position, which defines the center of the circle.
Stable.
Common extensions to Unity’s MonoBehaviour
class.
RenderGizmos(EditorUtils.RenderState): Wraps multiple separate Unity calls into one, using a RenderState
type.
Stable.
Base class for all Phase Jump nodes in 3D/2D space.
Contains state machine and auto culling for off camera objects.
Stable.
Utilities for random choices & behavior.
ChooseFrom(Type[]): Returns a random element from the array, or a default
value if the array is empty.
ChooseFrom(List): Returns a random element from the list, or a default
value if the array is empty.
VaryFloat(float value, float vary): Returns the original float value + a random delta.
Example: float(10, 3)
produces random values between 7-13.
Delta(float delta): Returns a random value between -delta…delta
Simple utilities. Stable.
Spawns a game object inside a 2D rectangle determined by width, height. The spawn area extends from the spawner’s position, which defines the center of the rectangle.
Stable.
Specifies a grid location for a game object, with a screen offset. Causes the object to snap to the grid position in the editor.
Vector3Int value: Location in grid space (z axis is used for layers) Vector3 offset: Offset in screen space
Stable.