Class SpawnPolicyBuilder
Builder class for creating Spawn
Inheritance
Namespace: GUPS.EasyPooling.Policy
Assembly: cs.temp.dll.dll
Syntax
public class SpawnPolicyBuilder
Remarks
The Spawn
The builder pattern allows the step-by-step definition of a spawning policy, providing flexibility and ease of use.
Constructors
SpawnPolicyBuilder()
Initializes a new instance of the Spawn
Declaration
public SpawnPolicyBuilder()
SpawnPolicyBuilder(IRandom)
Initializes a new instance of the Spawn
Declaration
public SpawnPolicyBuilder(IRandom _Random)
Parameters
Type | Name | Description |
---|---|---|
IRandom | _Random | The randomization method to use for spawning. |
Methods
Build()
Builds a Spawn
Declaration
public SpawnPolicy Build()
Returns
Type | Description |
---|---|
Spawn |
The constructed Spawn |
Explosion2D(Vector2, Single, Single)
Creates a 2D (on the XY plane) explosion spawn policy with the specified parameters.
Declaration
public static SpawnPolicy Explosion2D(Vector2 _Center, float _Radius, float _Velocity)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | _Center | The center position of the explosion. |
System. |
_Radius | The radius of the explosion. |
System. |
_Velocity | The initial velocity of spawned objects. |
Returns
Type | Description |
---|---|
Spawn |
The generated Spawn |
Explosion3D(Vector3, Single, Single)
Creates a 3D explosion spawn policy with the specified parameters.
Declaration
public static SpawnPolicy Explosion3D(Vector3 _Center, float _Radius, float _Velocity)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | _Center | The center position of the explosion. |
System. |
_Radius | The radius of the explosion. |
System. |
_Velocity | The initial velocity of spawned objects. |
Returns
Type | Description |
---|---|
Spawn |
The generated Spawn |
Is2D()
Sets the spawning to 2D mode.
Declaration
public SpawnPolicyBuilder Is2D()
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
Is2D(EPlane)
Sets the spawning to 2D mode.
Declaration
public SpawnPolicyBuilder Is2D(EPlane _Plane)
Parameters
Type | Name | Description |
---|---|---|
EPlane | _Plane | The 2D plane to spawn on. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
Is3D()
Sets the spawning to 3D mode.
Declaration
public SpawnPolicyBuilder Is3D()
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SetCenter(Vector3)
Sets the center position for spawning objects.
Declaration
public SpawnPolicyBuilder SetCenter(Vector3 _Center)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | _Center | The center position. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SetVelocity(Single)
Set the rigidbody velocity of the spawned objects to move aways from the center with the passed velocity.
Declaration
public SpawnPolicyBuilder SetVelocity(float _Velocity)
Parameters
Type | Name | Description |
---|---|---|
System. |
_Velocity | The velocity of the spawned objects. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SetVelocity(Vector3, Single)
Set the rigidbody velocity of the spawned objects to the specified direction and velocity.
Declaration
public SpawnPolicyBuilder SetVelocity(Vector3 _Direction, float _Velocity)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | _Direction | The direction of the velocity. |
System. |
_Velocity | The velocity of the spawned objects. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInBox()
Sets the spawning shape to a square with boundaries of size one. Every GameObject will be spawned in a square around the center with the boundaries [-1, 1] in each direction.
Declaration
public SpawnPolicyBuilder SpawnInBox()
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInBox(Box)
Sets the spawning shape to a square with the specified minimum and maximum positions. Every GameObject will be spawned in a square around the center within the passed boundaries.
Declaration
public SpawnPolicyBuilder SpawnInBox(Box _Boundaries)
Parameters
Type | Name | Description |
---|---|---|
Box | _Boundaries |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInBox(Vector3)
Sets the spawning shape to a square with the passed boundaries. Every GameObject will be spawned in a square around the center within the passed boundaries.
Declaration
public SpawnPolicyBuilder SpawnInBox(Vector3 _Boundary)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | _Boundary |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInCircle(Single)
Sets the spawning area to a 2D circle (default is the XY plane) with the specified radius. Every GameObject will be spawned in a circle around the center within the specified radius.
Declaration
public SpawnPolicyBuilder SpawnInCircle(float _Radius)
Parameters
Type | Name | Description |
---|---|---|
System. |
_Radius | The radius of the circle. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInCircle(Single, EPlane)
Sets the spawning area to a 2D circle (default is the XY plane) with the specified radius. Every GameObject will be spawned in a circle around the center within the specified radius.
Declaration
public SpawnPolicyBuilder SpawnInCircle(float _Radius, EPlane _Plane)
Parameters
Type | Name | Description |
---|---|---|
System. |
_Radius | The radius of the circle. |
EPlane | _Plane | The 2D plane to spawn on. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInCircle(Single, EPlane, Tuple<Single, Single>)
Sets the spawning area to a 2D circle (default is the XY plane) with the specified radius. Every GameObject will be spawned in a circle around the center within the specified radius.
Declaration
public SpawnPolicyBuilder SpawnInCircle(float _Radius, EPlane _Plane, Tuple<float, float> _Limit)
Parameters
Type | Name | Description |
---|---|---|
System. |
_Radius | The radius of the circle. |
EPlane | _Plane | The 2D plane to spawn on. |
System. |
_Limit |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInCircle(Single, EPlane, Tuple<Single, Single>[])
Sets the spawning area to a 2D circle (default is the XY plane) with the specified radius. Every GameObject will be spawned in a circle around the center within the specified radius.
Declaration
public SpawnPolicyBuilder SpawnInCircle(float _Radius, EPlane _Plane, Tuple<float, float>[] _Limits)
Parameters
Type | Name | Description |
---|---|---|
System. |
_Radius | The radius of the circle. |
EPlane | _Plane | The 2D plane to spawn on. |
System. |
_Limits | The spawn limits of the circle in radian [0, 2pi]. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInSphere(Single)
Sets the spawning area to a 3D sphere with the specified radius. Every GameObject will be spawned in a sphere around the center within the specified radius.
Declaration
public SpawnPolicyBuilder SpawnInSphere(float _Radius)
Parameters
Type | Name | Description |
---|---|---|
System. |
_Radius | The radius of the circle. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInSquare()
Sets the spawning area to a 2D square (the default is the XY plane) with boundaries of size one. Every GameObject will be spawned in a square around the center with the boundaries [-1, 1] in each direction.
Declaration
public SpawnPolicyBuilder SpawnInSquare()
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInSquare(Rect)
Sets the spawning area to a 2D square (the default is the XY plane) with the passed boundaries. Every GameObject will be spawned in a square around the center within the passed boundaries.
Declaration
public SpawnPolicyBuilder SpawnInSquare(Rect _Boundaries)
Parameters
Type | Name | Description |
---|---|---|
Rect | _Boundaries | The size of the square. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInSquare(Rect, EPlane)
Sets the spawning area to a 2D square (the default is the XY plane) with the passed boundaries. Every GameObject will be spawned in a square around the center within the passed boundaries.
Declaration
public SpawnPolicyBuilder SpawnInSquare(Rect _Boundaries, EPlane _Plane)
Parameters
Type | Name | Description |
---|---|---|
Rect | _Boundaries | The size of the square. |
EPlane | _Plane | The 2D plane to spawn on. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInSquare(Vector2)
Sets the spawning area to a 2D square (the default is the XY plane) with the passed boundaries. Every GameObject will be spawned in a square around the center within the passed boundaries.
Declaration
public SpawnPolicyBuilder SpawnInSquare(Vector2 _Boundary)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | _Boundary | The size of the square. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |
SpawnInSquare(Vector2, EPlane)
Sets the spawning area to a 2D square (the default is the XY plane) with the passed boundaries. Every GameObject will be spawned in a square around the center within the passed boundaries.
Declaration
public SpawnPolicyBuilder SpawnInSquare(Vector2 _Boundary, EPlane _Plane)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | _Boundary | The size of the square. |
EPlane | _Plane | The 2D plane to spawn on. |
Returns
Type | Description |
---|---|
Spawn |
The updated Spawn |