void Update() { if (!IsActive) { return; } if (!keyLock && InputWrapper.Pressed(Control.Pause)) { if (Globals.Paused) { Unpause(); } else { Pause(); } } else if (!keyLock && InputWrapper.Pressed(Control.DevOptions)) { if (Globals.Paused) { Unpause(); } else { PauseWithDevMenu(); } } else if (keyLock && !InputWrapper.Pressed(Control.Pause)) { keyLock = false; } }
protected override void Update() { // if we are showing the 'about' screen, // check for any key press to hide it if (isHidden) { if (optionsMenu.isActive && InputWrapper.Pressed(Control.MenuBack)) { HideChildMenu(optionsMenu); } else if (aboutMenu.isActive && Input.anyKeyDown) { HideChildMenu(aboutMenu); } } // otherwise, do the normal update else { if (isActive) { base.Update(); } } // current position var v3 = titleLogoTrans.position; // update the logo's position titleLogoTrans.position = new Vector3( v3.x, currentY, v3.z); // update the sine wave currentY = logoCenter + Mathf.Cos(angle) * logoDriftRange; angle += logoDriftSpeed * Time.deltaTime; }
protected override void Update() { base.Update(); // if we have a delayed tutorial counter, update that before proceeding if (tutorialDelayTimer > 0) { tutorialDelayTimer -= Time.deltaTime; if (tutorialDelayTimer <= 0) { tutorialDelayTimer = 0; ShowTutorial(); } } if (!isActive || isHidden) { return; } // if the countdown has expired, blink the exit string if (readyToExit) { exitBlinkTimer -= Time.deltaTime; if (exitBlinkTimer <= 0) { exitBlinkTimer = EXIT_BLINK_INTERVAL; exitBlinkState = !exitBlinkState; } } // count down the pre-delay before showing the exit string else { currentShowTime -= Time.deltaTime; if (currentShowTime <= 0) { readyToExit = true; currentShowTime = 0; exitRect.width = 0; exitString = "Press any key to continue."; exitBlinkTimer = EXIT_BLINK_INTERVAL; exitBlinkState = true; } } if (!controlsAreLocked && Input.anyKeyDown && readyToExit) { if (!Input.GetMouseButtonDown(0) && !InputWrapper.Pressed(Control.Shoot) && !InputWrapper.Pressed(Control.Pause)) { Hide(); Globals.pauser.Activate(); Globals.pauser.Unpause(); } } }
protected override void Update() { base.Update(); if (!isActive || isHidden) { return; } if (InputWrapper.Pressed(Control.Pause)) { ToggleShowTutorials(); } }
protected virtual void CheckForLeftRight() { if (!controlsAreLocked) { if (InputWrapper.Pressed(Control.MoveLeft)) { OnLeftPressed(); } else if (InputWrapper.Pressed(Control.MoveRight)) { OnRightPressed(); } } }
protected virtual void UpdateSelection() { if (itemCount == 0 || controlsAreLocked || !hasSelectableItems) { return; } int prevSel = sel; // check if the mouse has moved over a text-rect if (MouseWrapper.MouseHasMoved) { for (int i = 0; i < itemUnselRects.Count; i++) { // make sure we ignore spacer items if (items[i] == SPACER) { continue; } if (itemUnselRects[i].Contains(MouseWrapper.MouseXY)) { sel = i; break; } } } if (InputWrapper.Pressed(Control.MoveDown)) { // incrase selection while skipping any "spacers" do { sel = Utils.Wrap(sel + 1, 0, itemCount - 1); }while (items[sel] == SPACER); } else if (InputWrapper.Pressed(Control.MoveUp)) { // decrase selection while skipping any "spacers" do { sel = Utils.Wrap(sel - 1, 0, itemCount - 1); }while (items[sel] == SPACER); } // play the sound if selection has changed if (prevSel != sel) { snd.PlaySound(sndClick01); } }
void CheckShootingControls() { if (Input.GetMouseButtonDown(0) || InputWrapper.Pressed(Control.Shoot)) { var color = shootQueue.GetNextPiece(); if (color != PieceColor.Undefined) { PieceFactory.CreateShootingPiece( color, shootQueuePiece.trans.position); Globals.cursor.PlayShootAnim(); snd.PlaySound(SjSounds.playerShoot01); UpdateNextPiece(); shootQueueHUD.UpdateHUD(ref shootQueue); } } }
protected virtual void CheckForSelected() { if (controlsAreLocked || items.Count == 0 || !hasSelectableItems) { return; } if (InputWrapper.Pressed(Control.MenuSelect)) { OnItemSelected(); } if (Input.GetMouseButtonDown(0) && itemSelRects[sel].Contains(MouseWrapper.MouseXY)) { OnItemSelected(); } }
protected override void Update() { // if we are showing the 'about' screen, // check for any key press to hide it if (isHidden) { if (optionsMenu.isActive && InputWrapper.Pressed(Control.MenuBack)) { HideChildMenu(optionsMenu); } } // otherwise, do the normal update else { if (isActive) { base.Update(); } } }