Interface IParticleGraphicsAdapter
Serves as the bridge between the particles of the simulator and the render system. All particles have an instance of an implementation of this interface. Used to pass visual information to the graphical system and draw the particle with circuits and bonds to the screen.
Namespace: AS2.Visuals
Assembly: .dll
Syntax
public interface IParticleGraphicsAdapter
Methods
| Edit this page View SourceAddParticle(ParticleMovementState)
Adds and initializes the graphics of the particle. Call this each time a new particle has been added to the render system. Afterwards use Update(ParticleMovementState) repeatedly to update the particle visuals.
Declaration
void AddParticle(ParticleMovementState movementState)
Parameters
Type | Name | Description |
---|---|---|
ParticleMovementState | movementState | The current movement state of the particle to be added. |
BondUpdate(ParticleBondGraphicState)
Renders a particle bond for this round. Only call this on one of the two connected particles. Call Order: Update(ParticleMovementState) methods of all particles, then all BondUpdate(ParticleBondGraphicState) methods so that all bonds are rendered.
Declaration
void BondUpdate(ParticleBondGraphicState bondState)
Parameters
Type | Name | Description |
---|---|---|
ParticleBondGraphicState | bondState | Data about the current state of the bond. |
CircuitUpdate(ParticlePinGraphicState)
Pushes an update for the pin configuration of the particle and the immediate connections to neighboring particles.
Declaration
void CircuitUpdate(ParticlePinGraphicState state)
Parameters
Type | Name | Description |
---|---|---|
ParticlePinGraphicState | state | Data about the current state of the particle's pin configuration and neighbor connections. |
ClearParticleColor()
Call this when you want to remove the particle color. It goes back to default afterwards. This only needs to be called when the color which has been set manually should be removed.
Declaration
void ClearParticleColor()
HideParticle()
Complements ShowParticle(). Hides the particle. Call this if you want to hide the particle.
Declaration
void HideParticle()
RemoveParticle()
Removes the particle from the render system. Example: If you want to load a different setup of particles, all particles should be removed.
Declaration
void RemoveParticle()
SetParticleColor(Color)
Call this when you want to update the particle color. This only needs to be called when the color which has automatically been set when the particle was added to the rendering system should be changed in some way.
Declaration
void SetParticleColor(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The new color of the particle. |
ShowParticle()
Complements HideParticle(). Shows the particle. Calling this method is not necessary if the particle is never hidden. By default the particle is visible once it is added and updated.
Declaration
void ShowParticle()
Update(ParticleMovementState)
Updates the particle graphics. This is applied and shown directly in the next render cycle. Call it once per round, even if the particle has not moved.
Example: A particle has expanded. Call Update(ParticleMovementState) to update the visuals.
Declaration
void Update(ParticleMovementState movementState)
Parameters
Type | Name | Description |
---|---|---|
ParticleMovementState | movementState | The updated movement state of the particle. |
UpdateReset()
Like Update(ParticleMovementState), but forces the update to be applied visually without an animation, even if the particle positions are the same as in the previous frame.
Declaration
void UpdateReset()
UpdateReset(ParticleMovementState)
Like Update(ParticleMovementState), but forces the update to be applied visually without an animation, even if the particle positions are the same as in the previous frame.
Declaration
void UpdateReset(ParticleMovementState movementState)
Parameters
Type | Name | Description |
---|---|---|
ParticleMovementState | movementState | The new movement state of the particle. |