Class ParticleFactory
Factory for instantiating Particles with specific ParticleAlgorithm implementations attached to them.
To be called by ParticleSystem to initialize the simulation.
Inheritance
Namespace: AS2.Sim
Assembly: .dll
Syntax
public class ParticleFactory
Methods
| Edit this page View SourceCreateParticle(ParticleSystem, string, InitializationParticle, bool)
Creates a new particle for the specified algorithm using the given InitializationParticle as a template.
Declaration
public static Particle CreateParticle(ParticleSystem system, string algorithmId, InitializationParticle ip, bool initialize = false)
Parameters
Type | Name | Description |
---|---|---|
ParticleSystem | system | The system to which the particle will belong. |
string | algorithmId | The ID name of the algorithm that will control the particle's behavior. |
InitializationParticle | ip | The InitializationParticle that should be used as a template to copy the position, expansion state, chirality, compass direction and algorithm parameters from. |
bool | initialize | If |
Returns
Type | Description |
---|---|
Particle |
CreateParticle(ParticleSystem, string, Vector2Int, Direction, bool, Direction)
Creates a new particle for the specified algorithm.
Declaration
public static Particle CreateParticle(ParticleSystem system, string algorithmId, Vector2Int position, Direction compassDir = Direction.NONE, bool chirality = true, Direction headDir = Direction.NONE)
Parameters
Type | Name | Description |
---|---|---|
ParticleSystem | system | The system to which the particle will belong. |
string | algorithmId | The ID name of the algorithm that will control the particle's behavior. |
Vector2Int | position | The grid position of the particle's tail. |
Direction | compassDir | The global direction representing the particle's compass, i.e., the direction it believes to be E. |
bool | chirality | If |
Direction | headDir | The global direction of the particle's head if it should be expanded. |
Returns
Type | Description |
---|---|
Particle | A new particle with an attached algorithm instance. |