public void Update(GameTime gameTime, Controls _controls)
        {
            menuChoosen = false;

            if(_controls.menuUp() || _controls.menuRight())
            {
                menuItem++;
            }
            if (_controls.menuDown() || _controls.menuLeft())
            {
                menuItem--;
            }

            if (_controls.pause())
            {
                menuChoosen = true;
                menuItem = 1;
            }

            if (_controls.accept())
            {
                menuChoosen = true;
            }

            if (menuItem > 2)
                menuItem = 1;
            if (menuItem < 1)
                menuItem = 2;

            pauseSprite.Update(gameTime, menuItem);

            if (menuChoosen)
            {
                pauseSprite.IsVisible = false;
            }
        }
        public void Update(Controls _controls, GameTime gameTime)
        {
            animation.Update(gameTime);

            menuChoosen = false;
            if (_controls.menuUp())
            {
                menuItem--;
            }

            if (_controls.menuDown())
            {
                menuItem++;
            }

            if (menuItem > 4)
                menuItem = 1;
            if (menuItem < 1)
                menuItem = 4;

            if (_controls.accept())
                menuChoosen = true;
        }
Exemplo n.º 3
0
        public void Update(Controls playerController, GameTime gameTime)
        {
            //added by chad
            if (savingState != SavingState.NotSaving)
            {
                UpdateSave();
            }

            if (handleTimer)
            {
                if (timer > 0)
                    timer--;
                else { step += 1; handleTimer = false; }

                if (step > 5)
                    step = 5;
            }
            else
            {

                if (step == 1)
                {
                    liveHandle = true;
                    if (liquidHeight < (((livePercent / 100f) * 420f)))
                    {
                        liquidHeight += 1.0f;
                    }
                    else { handleTimer = true; collectiblesHandle = true; timer = 60; }
                }

                if (step == 2)
                {
                    if (liquidHeight < (((livePercent / 100f) * 420f) + ((collectiblesPercent / 100f) * 420f)))
                    {
                        liquidHeight += 1.0f;
                    }
                    else { handleTimer = true; scoreHandle = true; timer = 60; }
                }

                if (step == 3)
                {
                    if (liquidHeight < (((livePercent / 100f) * 420f) + ((collectiblesPercent / 100f) * 420f) + ((scorePercent / 100f) * 420f)))
                    {
                        liquidHeight += 1.0f;
                    }
                    else { handleTimer = true; killsHandle = true; timer = 60; }
                }

                if (step == 4)
                {
                    if (liquidHeight < (((livePercent / 100f) * 420f) + ((collectiblesPercent / 100f) * 420f) + ((scorePercent / 100f) * 420f) + ((killPercent / 100f) * 420f)))
                    {
                        liquidHeight += 1.0f;
                    }
                    else { handleTimer = true; timeHandle = true; timer = 60; }
                }

                if (step == 5 && lives > 0)
                {
                    if (liquidHeight < (((livePercent / 100f) * 420f) + ((collectiblesPercent / 100f) * 420f) + ((scorePercent / 100f) * 420f) + ((killPercent / 100f) * 420f) + ((timePercent / 100f) * 420f)))
                    {
                        liquidHeight += 1.0f;
                    }
                    else
                        if (newHighScoreHandle)
                            highScoreHandle = true;

                }
            }

            totalPercent = Math.Round((liquidHeight / 420f) * 100f) + "";

            if (liveHandle)
                liveScoreboard.Update(true);

            if (collectiblesHandle)
                collectiblesScoreboard.Update();

            if (scoreHandle)
                scoreScoreboard.Update();

            if (killsHandle)
                killScoreboard.Update();

            if (timeHandle)
                timeScoreboard.Update();

            if (highScoreHandle)
                if(lives == 0)
                    newHighScore.Update(true, true, true);
                else
                    newHighScore.Update(true, true);

            if (playerController.accept() && errorFreeSave)
                if (lives == 0)
                    sameLevel = true;
                else
                    nextLevel = true;

               updatePercent = ((liquidHeight*100f) / 420f);

               if (updateHealth < updatePercent && updateHealth <= livePercent)
               updateHealth += 0.42f;
               else if (updateCollectible < updatePercent - livePercent && updateCollectible < collectiblesPercent)
               updateCollectible += 0.42f;
               else if (updateScore < updatePercent - livePercent - collectiblesPercent && updateScore < scorePercent)
               updateScore += 0.42f;
               else if (updateKill < updatePercent - livePercent - collectiblesPercent - scorePercent && updateKill < killPercent)
               updateKill += 0.42f;
               else if (updateTime < updatePercent - livePercent - collectiblesPercent - scorePercent - killPercent && updateTime <= timePercent)
               updateTime += 0.42f;

               bubbles.position = new Vector2(230 + (bubbles.animationManager.Width / 2f), (liquidHeight * -1) + 500f + (bubbles.animationManager.Height / 2f));
               bubbles.Update(gameTime);
        }
        public void Update(Controls key)
        {
            if(!dataLoaded)
                LoadFromDevice();

            level0Percent = Convert.ToInt32(loadData.saveLevel0);
            level1Percent = Convert.ToInt32(loadData.saveLevel1);
            level2Percent = Convert.ToInt32(loadData.saveLevel2);
            level3Percent = Convert.ToInt32(loadData.saveLevel3);
            level4Percent = Convert.ToInt32(loadData.saveLevel4);
            level5Percent = Convert.ToInt32(loadData.saveLevel5);
            level6Percent = Convert.ToInt32(loadData.saveLevel6);
            level7Percent = Convert.ToInt32(loadData.saveLevel7);
            playedLevel0 = Convert.ToInt32(loadData.level0Played);
            averageLevel0 = Convert.ToUInt32(loadData.level0Average);
            playedLevel1 = Convert.ToInt32(loadData.level1Played);
            averageLevel1 = Convert.ToUInt32(loadData.level1Average);
            playedLevel2 = Convert.ToInt32(loadData.level2Played);
            averageLevel2 = Convert.ToUInt32(loadData.level2Average);
            playedLevel3 = Convert.ToInt32(loadData.level3Played);
            averageLevel3 = Convert.ToUInt32(loadData.level3Average);
            playedLevel4 = Convert.ToInt32(loadData.level4Played);
            averageLevel4 = Convert.ToUInt32(loadData.level4Average);
            playedLevel5 = Convert.ToInt32(loadData.level5Played);
            averageLevel5 = Convert.ToUInt32(loadData.level5Average);
            playedLevel6 = Convert.ToInt32(loadData.level6Played);
            averageLevel6 = Convert.ToUInt32(loadData.level6Average);
            playedLevel7 = Convert.ToInt32(loadData.level7Played);
            averageLevel7 = Convert.ToUInt32(loadData.level7Average);

            level0Fastest = Convert.ToInt32(loadData.level0Fastest);
            level1Fastest = Convert.ToInt32(loadData.level1Fastest);
            level2Fastest = Convert.ToInt32(loadData.level2Fastest);
            level3Fastest = Convert.ToInt32(loadData.level3Fastest);
            level4Fastest = Convert.ToInt32(loadData.level4Fastest);
            level5Fastest = Convert.ToInt32(loadData.level5Fastest);
            level6Fastest = Convert.ToInt32(loadData.level6Fastest);
            level7Fastest = Convert.ToInt32(loadData.level7Fastest);

            if (key.moveLeft() && timer == 0)
            {
                if (selected > 0)
                    selected--;

                timer = 30;
            }

            if (key.moveRight() && timer == 0)
            {
                if (selected < 7)
                    selected++;

                timer = 30;
            }

            level0Size = minScale;
            level1Size = minScale;
            level2Size = minScale;
            level3Size = minScale;
            level4Size = minScale;
            level5Size = minScale;
            level6Size = minScale;
            level7Size = minScale;

            level0Pos = new Vector2(2000, 0);
            level1Pos = new Vector2(2000, 0);
            level2Pos = new Vector2(2000, 0);
            level3Pos = new Vector2(2000, 0);
            level4Pos = new Vector2(2000, 0);
            level5Pos = new Vector2(2000, 0);
            level6Pos = new Vector2(2000, 0);
            level7Pos = new Vector2(2000, 0);

            switch (selected)
            {
                case 0:
                    {
                        level0Size = maxScale;
                        level0Pos = new Vector2(0, 0);
                        level1Pos = new Vector2(410, 76);
                    }
                    break;
                case 1:
                    {
                        level1Size = maxScale;
                        level0Pos = new Vector2(-210, 76);
                        level1Pos = new Vector2(0, 0);
                        level2Pos = new Vector2(410, 76);
                    }
                    break;
                case 2:
                    {
                        level2Size = maxScale;
                        level1Pos = new Vector2(-210, 76);
                        level2Pos = new Vector2(0, 0);
                        level3Pos = new Vector2(410, 76);
                    }
                    break;
                case 3:
                    {
                        level3Size = maxScale;
                        level2Pos = new Vector2(-210, 76);
                        level3Pos = new Vector2(0, 0);
                        level4Pos = new Vector2(410, 76);
                    }
                    break;
                case 4:
                    {
                        level4Size = maxScale;
                        level3Pos = new Vector2(-210, 76);
                        level4Pos = new Vector2(0, 0);
                        level5Pos = new Vector2(410, 76);
                    }
                    break;
                case 5:
                    {
                        level5Size = maxScale;
                        level4Pos = new Vector2(-210, 76);
                        level5Pos = new Vector2(0, 0);
                        level6Pos = new Vector2(410, 76);
                    }
                    break;
                case 6:
                    {
                        level6Size = maxScale;
                        level5Pos = new Vector2(-210, 76);
                        level6Pos = new Vector2(0, 0);
                        level7Pos = new Vector2(410, 76);
                    }
                    break;
                case 7:
                    {
                        level7Size = maxScale;
                        level6Pos = new Vector2(-210, 76);
                        level7Pos = new Vector2(0, 0);

                    }
                    break;

                default: break;
            }

            if (key.accept() && timer == 0)
            {
                if (selected == 0)
                    menuChoosen = true;
                if (selected == 1 && level0Percent > 0)
                    menuChoosen = true;
                if (selected == 2 && level1Percent > 0)
                    menuChoosen = true;
                if (selected == 3 && level2Percent > 0)
                    menuChoosen = true;
                if (selected == 4 && level3Percent > 0)
                    menuChoosen = true;
                if (selected == 5 && level4Percent > 0)
                    menuChoosen = true;
                if (selected == 6 && level5Percent > 0)
                    menuChoosen = true;
                if (selected == 7 && level6Percent > 0)
                    menuChoosen = true;

                timer = 30;
            }

            if (timer > 0)
                timer--;
        }