Class SpawnPolicy
Defines the parameters for object spawning, including the randomization method, dimensionality, shape, center, radius, spawn position limits, and initial velocity.
Inheritance
Namespace: GUPS.EasyPooling.Policy
Assembly: cs.temp.dll.dll
Syntax
public class SpawnPolicy
Remarks
The SpawnPolicy class encapsulates the specifications for spawning objects within a game environment. It provides detailed configurations such as the randomization method, dimensionality (2D or 3D), spawning shape (sphere or square), spawn limits, center position, radius, boundaries, and initial velocity.
Instances of this class serve as a scheme for applying spawning policies to GameObjects, facilitating controlled and dynamic object generation within a game scene.
Constructors
SpawnPolicy()
Initializes a new instance of the SpawnPolicy class with default values.
Declaration
public SpawnPolicy()
Properties
Boundaries
Gets or sets the spawning area for objects in a square.
Declaration
public Box Boundaries { get; set; }
Property Value
Type | Description |
---|---|
Box |
Center
Gets or sets the center position for spawning objects.
Declaration
public Vector3 Center { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Direction
Gets or sets the direction of the velocity.
Declaration
public Vector3 Direction { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
InSphere
Gets or sets a value indicating whether objects should be spawned in a sphere (true) or a square (false).
Declaration
public bool InSphere { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Is2D
Gets or sets a value indicating whether the spawning is in 2D space.
Declaration
public bool Is2D { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
MoveAwayFromCenter
Get or sets if the velocity should be away from the center.
Declaration
public bool MoveAwayFromCenter { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Plane2D
Gets or sets the 2D plane. Default is the XY plane.
Declaration
public EPlane Plane2D { get; set; }
Property Value
Type | Description |
---|---|
EPlane |
Radius
Gets or sets the radius for spawning objects in circular distributions.
Declaration
public float Radius { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Random
Gets or sets the randomization method used for spawning.
Declaration
public IRandom Random { get; set; }
Property Value
Type | Description |
---|---|
IRandom |
SphereLimits
Gets or sets the spawn limits for objects in a sphere in radian [0, 2pi].
Declaration
public Tuple<float, float>[] SphereLimits { get; set; }
Property Value
Type | Description |
---|---|
System.Tuple<System.Single, System.Single>[] |
Velocity
Gets or sets the initial velocity for spawned objects.
Declaration
public float Velocity { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
Apply(GameObject)
Apply the policy on the passed GameObject.
Declaration
public void Apply(GameObject _Object)
Parameters
Type | Name | Description |
---|---|---|
GameObject | _Object | The GameObject to apply the policy on. |