public void Update(float sceneOffset, bool controlsEnabled) { _smokeParticles.ForEach(x => x.Update()); _smokeParticles.RemoveAll(x => x.IsFinished); _stoneParticles.ForEach(x => x.Update()); _stoneParticles.RemoveAll(x => x.IsFinished); if (Math.Abs(sceneOffset - _renderOffset) >= 0.5 || !controlsEnabled) { return; } if (_messages.Count > 0) { _scene.SubtitleWidget.AddDelay(); _messages.ForEach(message => _scene.SubtitleWidget.AddSubtitle(message.Text, message.VoiceOver)); _messages.Clear(); } for (var i = 0; i < _actionBrickRenders.Count; i++) { _actionBrickRenders[i].Update(_actionBrickRenders.Count, i); } if (IsCompleted) { return; } _glyphRenderers.ForEach(glyph => glyph.Update()); var actionInput = GetActionInput(); if (actionInput.HasValue && _actionBrickRenders.Count < S.MaxActionsInLevel && !_isHiding) { _actionBrickRenders.Add(new RendererActionBrick(actionInput.Value, _actionBrickRenders.Count)); Sfx.PlayGlassSound(actionInput.Value); } if (KeyboardManager.Instance.IsKeyJustPressed(Keys.Enter) && !_isHiding) { if (CompareLists(_actionBrickRenders, _solution)) { if (_renderOffset == S.LastLevelIndex) { Save.LastLevel = S.LastLevelIndex + 1; Save.WriteSave(); Sfx.MusicInstance.Stop(); GameCore.Instance.SceneManager.SetScene(new OutroSmackScene()); return; } IsCompleted = true; GameCore.Instance.ShakePower += 2; _smokeParticles.Add(new ParticleSmoke()); _smokeParticles.Add(new ParticleSmoke()); _smokeParticles.Add(new ParticleSmoke()); _smokeParticles.Add(new ParticleSmoke()); _smokeParticles.Add(new ParticleSmoke()); _smokeParticles.Add(new ParticleSmoke()); _smokeParticles.Add(new ParticleSmoke()); _smokeParticles.Add(new ParticleSmoke()); _smokeParticles.Add(new ParticleSmoke()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); _stoneParticles.Add(new ParticleStone()); Sfx.PlayLevelCompleted(); Save.LastLevel = (int)_renderOffset + 1; Save.WriteSave(); } else { for (var i = 0; i < _actionBrickRenders.Count; i++) { _actionBrickRenders[i].IsHiding = true; _actionBrickRenders[i].HidingDelay = i * 3; GameCore.Instance.RegisterDelayedAction(i * 3, GetSfxReverseSoundAction(_actionBrickRenders[i].Action)); } _isHiding = true; } } if (_isHiding) { if (_actionBrickRenders.All(brick => brick.IsFinished)) { _actionBrickRenders.Clear(); _isHiding = false; } } else { _actionBrickRenders.RemoveAll(x => x.IsFinished); } if (KeyboardManager.Instance.IsKeyJustPressed(Keys.Back) && !_isHiding && _actionBrickRenders.Count > 0) { var brick = _actionBrickRenders.FindLast(x => !x.IsHiding); if (brick != null) { brick.IsHiding = true; Sfx.PlayGlassReverseSound(brick.Action); } } }