Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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();
                }
            }
        }
Ejemplo n.º 4
0
        protected override void Update()
        {
            base.Update();
            if (!isActive || isHidden)
            {
                return;
            }

            if (InputWrapper.Pressed(Control.Pause))
            {
                ToggleShowTutorials();
            }
        }
Ejemplo n.º 5
0
 protected virtual void CheckForLeftRight()
 {
     if (!controlsAreLocked)
     {
         if (InputWrapper.Pressed(Control.MoveLeft))
         {
             OnLeftPressed();
         }
         else if (InputWrapper.Pressed(Control.MoveRight))
         {
             OnRightPressed();
         }
     }
 }
Ejemplo n.º 6
0
        void CheckMovementControls()
        {
            if (InputWrapper.Held(Control.MoveLeft))
                velX = -1;
            else if (InputWrapper.Held(Control.MoveRight))
                velX = 1;
            else velX = 0;

            if (InputWrapper.Held(Control.MoveUp))
                velY = 1;
            else if (InputWrapper.Held(Control.MoveDown))
                velY = -1;
            else velY = 0;
        }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
0
 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);
         }
     }
 }
Ejemplo n.º 9
0
        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();
            }
        }
Ejemplo n.º 10
0
 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();
         }
     }
 }