private void Update()
    {
        // check if [ESC] was pressed
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            SceneManager.LoadScene("Laboratory");
        }

        // check if [E] was pressed (PLAY/PAUSE Simulation)
        if (Input.GetKeyDown(KeyCode.E))
        {
            if (simController.SimulationRunning)
            {
                simController.StopSimulation();
            }
            else
            {
                simController.StartSimulation();
            }
        }

        // check if [R] was pressed (Reset Simulation)
        if (Input.GetKeyDown(KeyCode.R))
        {
            simController.ResetSimulation();
        }

        // check if [S] was pressed (Step Simulation)
        if (Input.GetKeyDown(KeyCode.S))
        {
            simController.SimulateStep();
        }

        // check if [I] was pressed (Iron Filings)
        if (Input.GetKeyDown(KeyCode.I))
        {
            if (_ironFiling)
            {
                _ironFiling.generateFieldImage();
            }
        }
    }
Exemple #2
0
 /// <summary>
 /// Handles the button being pressed and resets the simulation
 /// </summary>
 public void buttonResetPressed()
 {
     simController.ResetSimulation();
 }