/// <summary> /// Checks for the pause hotkey. /// </summary> private void Update() { if (!GameManager.instance.isCountingDown && InputUtil.GetKeyDown(KeyCode.P)) { paused = !paused; } }
/// <summary> /// Checks for the user resetting the level. /// </summary> private void Update() { if (!_levelRequested && InputUtil.GetKeyDown(KeyCode.G) && Input.GetKey(KeyCode.LeftShift)) { GetComponent <LevelCreator>().RequestLevel(); } if (isPlaying && !PauseHandler.instance.paused) { if (!_isCountingDown) { _currentTime += Time.deltaTime; } if (Input.GetButton("Reset")) { if (InputUtil.GetKey(KeyCode.LeftShift)) { RestartScene(); } else { ResetLevel(); } } else if (CountLemmings() == 0 && lemmingSpawner != null && lemmingSpawner.IsFinished() && !pathRenderer.visible) { numDeaths++; if (showPath) { pathRenderer.visible = true; PlayerMover.instance.noClip = true; isPlaying = false; } else { ResetLevel(); } } if (InputUtil.GetKeyDown(KeyCode.O)) { _freezeLemmings = !freezeLemmings; } } }
/// <summary> /// Switches the selected block if the user scrolls. /// </summary> private void SwitchBlock() { SetGhostBlockVisibility(false); float scroll = InputUtil.GetScrollWheel(); if (scroll != 0) { if (scroll < 0) { _selectedBlock++; if ((int)_selectedBlock >= numBlockTypes) { _selectedBlock--; } } else { _selectedBlock--; if (_selectedBlock < 0) { _selectedBlock = 0; } } } else if (Input.GetButtonDown("Fire3")) { _selectedBlock++; if ((int)_selectedBlock >= numBlockTypes) { _selectedBlock = 0; } } else { for (KeyCode key = KeyCode.Alpha1; key <= keyLimit; key++) { if (InputUtil.GetKeyDown(key)) { _selectedBlock = (BlockType)(key - KeyCode.Alpha1); } } } }