Class AmoebotSimulator
The main class of the entire simulator. Manages the particle system and the render system and provides the high-level interface for controlling the simulation. This class triggers the main render call in each frame and the round simulation in each fixed update.
Inheritance
Namespace: AS2
Assembly: .dll
Syntax
public class AmoebotSimulator : MonoBehaviour
Constructors
| Edit this page View SourceAmoebotSimulator()
Declaration
public AmoebotSimulator()
Fields
| Edit this page View Sourceinstance
The singleton instance of the class.
Declaration
public static AmoebotSimulator instance
Field Value
Type | Description |
---|---|
AmoebotSimulator |
renderSystem
The render system handling the visualization.
Declaration
public RenderSystem renderSystem
Field Value
Type | Description |
---|---|
RenderSystem |
running
Whether the simulation is currently running.
Declaration
public bool running
Field Value
Type | Description |
---|---|
bool |
system
The particle system handling the simulation.
Declaration
public ParticleSystem system
Field Value
Type | Description |
---|---|
ParticleSystem |
uiHandler
Reference to the UI handler root object.
Declaration
public UIHandler uiHandler
Field Value
Type | Description |
---|---|
UIHandler |
Methods
| Edit this page View SourceFixedUpdate()
Declaration
private void FixedUpdate()
OpenInitModeCoroutine()
Helper coroutine that opens the Init Mode UI after waiting for all required components to be initialized.
Declaration
private IEnumerator OpenInitModeCoroutine()
Returns
Type | Description |
---|---|
IEnumerator |
PauseSim()
Pauses the simulation.
Declaration
public void PauseSim()
PlaySim()
Starts playing the simulation.
Declaration
public void PlaySim()
PlayStep()
Triggers the simulation of a single round or a step forward in the simulation history, depending on where the marker is. Called on each FixedUpdate while the simulation is running.
Declaration
public void PlayStep()
RoundChanged()
Triggers UI updates after the displayed round has changed in Simulation Mode. Should be called every time the round changes.
Declaration
public void RoundChanged()
SetSimSpeed(float)
Updates the simulation speed to the given value.
Declaration
public void SetSimSpeed(float roundTime)
Parameters
Type | Name | Description |
---|---|---|
float | roundTime | The time between two round simulations. |
Start()
Declaration
private void Start()
TogglePlayPause()
Toggles the play state of the simulation between Playing and Paused.
Declaration
public void TogglePlayPause()
Update()
Declaration
private void Update()