private void Start() { pipes = Ets.Room.GetGame <PipesGame>(); crane = Ets.Room.GetGame <CratesGame>(); dynamite = Ets.Room.GetGame <DynamiteGame>(); trigger = Ets.Room.GetGame <TriggersGame>(); }
private void OnFanTriggered(PipesGame sender, FanTriggeredEventArgs e) { // whenever a fan starts or stops, we check if the subsystem it belongs to has been solved by this very state change // if this is the case and the subsystem had not reached a solved state previously, some audio feedback (e.g. "well done!") should be played if (e.System.RunningFansCount >= e.System.FanCount && !solvedSubsystems[e.System.Index]) { solvedSubsystems[e.System.Index] = true; // if two subsystem are solved in quick succession, another voice sample might still be playing which we need to stop first audio.StopVoice(49, 50, 51); // select and play a voice sample depending on how many subsystems have been solved switch (e.System.Index) { case 0: audio.PlayVoice(49); break; case 1: audio.PlayVoice(50); break; case 2: audio.PlayVoice(51); break; } } }
// Use this for initialization void Awake() { pnlGrid = transform.Find("pnlGrid"); lblFanCount = transform.Find("lblFanCount").GetComponent <Text>(); game = Ets.Room.GetGame <PipesGame>(); game.OnGameStateChanged += OnGameStateChanged; game.OnValveTurned += OnValveTurned; game.OnFanTriggered += OnFanTriggered; //OnGameStateChanged(game, game.State, game.State); }
public void OnFanTriggered(PipesGame sender, FanTriggeredEventArgs e) { // if the system with this fan is solved for the first time... if (e.System.RunningFansCount == e.System.FanCount && !solvedPipeSystems[e.System.Index]) { solvedPipeSystems[e.System.Index] = true; // only make the drill sound louder if the game is not solved if (solvedPipeSystems.Contains(false)) { drillVolume += DrillVolumeStep; audio.ChangeSoundVolume(02, drillVolume); } } }
private void OnScoresUpdated(ScoringModule sender, ScoresUpdatedEventArgs e) { PipesGame pipes = Ets.Room.GetGame <PipesGame>(); lblScorePipes.text = e.Scores.ContainsScore(pipes) ? e.Scores.GetScore(pipes).ToString() : "-"; CratesGame crates = Ets.Room.GetGame <CratesGame>(); lblScoreCrane.text = e.Scores.ContainsScore(crates) ? e.Scores.GetScore(crates).ToString() : "-"; DynamiteGame dynamite = Ets.Room.GetGame <DynamiteGame>(); lblScoreDynamite.text = e.Scores.ContainsScore(dynamite) ? e.Scores.GetScore(dynamite).ToString() : "-"; TriggersGame trigger = Ets.Room.GetGame <TriggersGame>(); lblScoreTrigger.text = e.Scores.ContainsScore(trigger) ? e.Scores.GetScore(trigger).ToString() : "-"; }
private IEnumerator GameRunning(PipesGame game) // called when the game has been started // check regularly if the game is still running or the timeout has been reached { WaitForSeconds interval = new WaitForSeconds(.5f); while (game.State == GameState.Running && game.ElapsedTime <= RoomMaster.MaxTimePipes) { yield return(interval); } // if the game is running, this means the timeout has been reached, so we abort the game if (game.State == GameState.Running) { Debug.Assert(game.ElapsedTime > RoomMaster.MaxTimePipes, "Timeout not reached."); game.Abort(); } }
protected override void Setup() { PipesGame pipes = Room.GetGame <PipesGame>(); pipes.OnValveTurned += OnValveTurned; pipes.OnFanTriggered += OnFanTriggered; crates = Room.GetGame <CratesGame>(); crates.OnCrateDropped += OnCrateDropped; crates.OnCratePickedUp += OnCratePickedUp; DynamiteGame dynamite = Room.GetGame <DynamiteGame>(); dynamite.OnInstructionSolvedStateChanged += OnInstructionSolvedStateChanged; dynamite.OnStickInserted += OnStickInserted; dynamite.OnStickRemoved += OnStickRemoved; TriggersGame trigger = Room.GetGame <TriggersGame>(); trigger.OnButtonPressed += OnButtonPressed; }
public override void OnRoomStateChanged(EscapeRoom <IEtsInterface> sender, RoomStateChangedEventArgs e) { if (e.NewState == RoomState.Uninitialized) { // start a new record Statistics = new Statistics(); PipesGame pipes = sender.GetGame <PipesGame>(); foreach (PipeSystem ps in pipes.PipeSystems()) { Statistics.valvesTurnedPerSubsystem[ps.Index] = 0; Statistics.runningFansPerSubsystem[ps.Index] = 0; } } if (e.NewState == RoomState.Completed || e.NewState == RoomState.Aborted) { // write active record to file Statistics.WriteCSV(Ets.AnalyticsPath + filename); } }
public void onFanTriggered(PipesGame sender, FanTriggeredEventArgs e) { if (e.Fan.IsRunning) { Statistics.pipesRunningFans++; Statistics.runningFansPerSubsystem[e.System.Index]++; if (Statistics.pipesRunningFans > Statistics.pipesMaxRunningFans) { Statistics.pipesMaxRunningFans = Statistics.pipesRunningFans; } } else { Statistics.pipesRunningFans--; Statistics.runningFansPerSubsystem[e.System.Index]--; } if (e.System.RunningFansCount == e.System.FanCount) { Statistics.pipesSolvedSubsystems++; } }
protected override void Setup() { pipes = Room.GetGame <PipesGame>(); pipes.OnValveTurned += OnValveTurned; pipes.OnFanTriggered += OnFanTriggered; CratesGame crates = Room.GetGame <CratesGame>(); crates.OnCraneDeploymentFinished += OnCraneDeploymentFinished; crates.OnCraneDeploymentStarted += OnCraneDeploymentStarted; crates.OnCraneMovementStarted += OnCraneMovementStarted; crates.OnCraneMovementStopped += OnCraneMovementStopped; crates.OnCrateDropped += OnCrateDropped; crates.OnCratePickedUp += OnCratePickedUp; DynamiteGame dynamite = Room.GetGame <DynamiteGame>(); dynamite.OnStickInserted += OnStickInserted; dynamite.OnStickRemoved += OnStickRemoved; TriggersGame trigger = Room.GetGame <TriggersGame>(); trigger.OnButtonPressed += OnButtonPressed; }
public void OnValveTurned(PipesGame sender, ValveTurnedEventArgs e) { audio.PlaySound(13); }
public void OnFanTriggered(PipesGame sender, FanTriggeredEventArgs e) { //print("PipesView.OnFanTriggered: " + fan.X + " " + fan.Y); gridElementImages[e.Fan.PxCoords].color = e.Fan.IsRunning ? activeFan : inactiveFan; lblFanCount.text = string.Format(fanCountStrF, sender.RunningFansCount, sender.FanCount); }
public void OnValveTurned(PipesGame sender, ValveTurnedEventArgs e) { //print("PipesView.OnValveTurned: " + valve.X + " " + valve.Y); gridElementImages[e.Valve.PxCoords].color = e.Valve.IsOpen ? openValve : closedValve; }
private void OnValveTurned(PipesGame sender, ValveTurnedEventArgs e) { Record(new ValveStateChange(e.System.Index, e.Valve.Row, e.Valve.PositionInRow, e.Valve.IsOpen)); }
public void onValveTurned(PipesGame sender, ValveTurnedEventArgs e) { Statistics.valvesTurnedPerSubsystem[e.System.Index]++; }
private Dictionary <int, bool> solvedSubsystems; // keeps track of subsystems (identified by index from 0 to 3) that have reached a solved state once throughout the playthrough protected override void Setup() { // retrieve the pipes game from the room and register for fan events game = Room.GetGame <PipesGame>(); game.OnFanTriggered += OnFanTriggered; }
private void OnEnable() { Log.Verbose("Starting maintenance mode..."); room = Ets.Room; pipes = room.GetGame <PipesGame>(); lighting.SwitchAllLights(LightSetting.On); success = false; readInitialState = true; record = new MaintenanceRecord(); // pipes List <int> valvesPerPipeSystem = new List <int>(); List <int> fansPerPipeSystem = new List <int>(); foreach (PipeSystem ps in pipes.PipeSystems()) { valvesPerPipeSystem.Add(ps.ValveCount); fansPerPipeSystem.Add(ps.FanCount); } initialValveStates = new bool[valvesPerPipeSystem.Count][]; record.valvesPerPipeSystem_Rotating = new bool[valvesPerPipeSystem.Count][]; record.valvesPerPipeSystem_StateChanges = new bool[valvesPerPipeSystem.Count][]; for (int i = 0; i < valvesPerPipeSystem.Count; i++) { initialValveStates[i] = new bool[valvesPerPipeSystem[i]]; record.valvesPerPipeSystem_Rotating[i] = new bool[valvesPerPipeSystem[i]]; record.valvesPerPipeSystem_StateChanges[i] = new bool[valvesPerPipeSystem[i]]; } record.fansPerPipeSystem = new bool[fansPerPipeSystem.Count][]; for (int i = 0; i < fansPerPipeSystem.Count; i++) { record.fansPerPipeSystem[i] = new bool[fansPerPipeSystem[i]]; } foreach (Fan f in pipes.Fans()) { room.Physical.SetFanState(f.Row, f.PositionInRow, true); } // crane record.craneButtons = new bool[CratesGame.ButtonCount]; // dynamite initialHoleStates = new int[DynamiteGame.HoleCount]; record.holes = new bool[DynamiteGame.HoleCount]; // trigger record.triggerButtons = new bool[TriggersGame.ButtonCount]; Color[] colors = new Color[TriggersGame.LedCount]; for (int i = 0; i < colors.Length; i++) { colors[i] = Color.blue; } room.Physical.SetLEDColors(colors); Log.Verbose("Maintenance mode started. Waiting for input..."); }
private void OnFanTriggered(PipesGame sender, FanTriggeredEventArgs e) { Record(new FanTriggered(e.System.Index, e.Fan.Row, e.Fan.PositionInRow, e.Fan.IsRunning)); }