/// <summary> /// Initializes the whole page. Called before the node is added to the tree by the lesson controller. /// </summary> public override void InitialiseWith(IMainNode mainNode, ILessonEntity openedLesson) { CentralParticles = GetNode <CentralParticles>("CentralParticles"); CentralParticles.Setup(); EmergencyActors = GetNode <EmergencyActors>("EmergencyActors"); EmergencyActors.Setup(); _decoration = GetNode <DecorationNode>("DecorationNode"); _decoration.Initialise(); }
/// <summary> /// Resets the simulation back to the start /// </summary> public void ResetSimulation() { SystemState = State.BuildUp; _particleTime = 0; SafeguardResetSignal = false; AlarmLightSignal = false; ChargingSignal = false; FillingSignal = false; CentralParticles.Reset(); SafeguardSignal = false; AcknowledgeButtonSignal = false; BatterySignal = 46f; PressureSignal = 2012; }
/// <summary> /// Procedure: /// 1. Build up particles /// 2. Release particles (experiment failure), discharge capacitor banks and preassure -> update detector /// 3. Stop particle emission, wait /// 4. Back to normal -> update detector /// </summary> private void UpdateExperimentSimulation(int deltaTime) { switch (SystemState) { case State.BuildUp: CentralParticles.ShowAs(true, false, false); _particleTime += deltaTime; _decoration.UpdateToFailure(8000 - _particleTime); if (_particleTime >= 8000) { _particleTime = 0; SystemState = State.Release; SafeguardSignal = true; BatterySignal = 12f; PressureSignal = 1021; } break; case State.Release: CentralParticles.ShowAs(false, false, false); _particleTime += deltaTime; if (_particleTime >= 10000) { _particleTime = 0; SystemState = State.Reset; } break; case State.Reset: if (!SafeguardSignal) { SystemState = State.BuildUp; } break; case State.Failure: SafeguardSignal = true; break; } }