Update() private method

private Update ( ) : void
return void
Esempio n. 1
0
        public override void Update()
        {
            base.Update();

            Back.Update();
            if (Back.Press())
            {
                Options.SaveOptions();
                SceneManager.ChangeScene(SceneManager.menuScene);
            }

            Controls.Update();
            if (Controls.Press())
            {
                SceneManager.ChangeScene(SceneManager.controlScene);
            }

            TutorialTips.Update();
            if (TutorialTips.Press())
            {
                TipsEnable               = !TipsEnable;
                TutorialTips.Write       = "Tips: " + TipsEnable.ToString();
                TutorialTips.NormalColor = TipsEnable ? Color.Green : Color.Red;
            }

            StarChanceSlider.Update();
            SoundVolumeSlider.Update();
            MusicVolumeSlider.Update();
        }
Esempio n. 2
0
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     musicDown.Update(gameTime);
     musicUp.Update(gameTime);
     soundDown.Update(gameTime);
     soundUp.Update(gameTime);
     back.Update(gameTime);
 }
Esempio n. 3
0
        public override void Update()
        {
            base.Update();

            Back.Update();
            if (Back.Press())
            {
                SceneManager.ChangeScene(SceneManager.mapScene);
            }

            RankInfo.Update();
        }
Esempio n. 4
0
        public override void Update()
        {
            base.Update();

            SceneManager.mapScene.ThePlayer.UpdateInventory();

            Back.Update();
            if (Back.Press())
            {
                SceneManager.ChangeScene(SceneManager.mapScene);
            }

            InventoryInfo.Update();
            CraftingInfo.Update();
        }
Esempio n. 5
0
        public void TextboxUpdate(MouseState mouse)
        {
            Save.Update(mouse);
            Back.Update(mouse);
            NameUpdate();
            if (Save.IsClicked)
            {
                NameInput = false;
                IsUsed    = true;
                Date      = DateTime.Now.ToString(CultureInfo.CurrentCulture);
                Text      = Name + "  " + Game1.Lvl + ". lvl";
            }

            if (Back.IsClicked)
            {
                NameInput = false;
                Name      = "";
            }
        }
Esempio n. 6
0
        public override void Update()
        {
            base.Update();

            if (Back.Press())
            {
                SceneManager.ChangeScene(SceneManager.menuScene);
            }

            Back.Update();

            Info.Update();

            for (int i = 0; i < ShipButtons.Count(); i++)
            {
                ShipButtons[i].Update();
                if (ShipButtons[i].Pressed())
                {
                    SceneManager.mapScene.Initialize();
                    SceneManager.ChangeScene(SceneManager.mapScene);
                    SceneManager.mapScene.ThePlayer.Texture = ShipButtons[i].Texture;
                    SceneManager.started = true;
                    if (i == 0)
                    {
                        SceneManager.mapScene.ThePlayer.EngineAnimation = TextureManager.ship1EngineAnimation;
                        SceneManager.mapScene.ThePlayer.MaxFrame        = 3;
                        break;
                    }
                    else if (i == 1)
                    {
                        SceneManager.mapScene.ThePlayer.EngineAnimation = TextureManager.ship2EngineAnimation;
                        SceneManager.mapScene.ThePlayer.MaxFrame        = 3;
                        break;
                    }
                    else if (i == 2)
                    {
                        SceneManager.mapScene.ThePlayer.EngineAnimation = TextureManager.ship3EngineAnimation;
                        SceneManager.mapScene.ThePlayer.MaxFrame        = 1;
                        break;
                    }
                }
            }
        }
Esempio n. 7
0
        public void Update()
        {
            vibrationStrength += (vibrationFadeToStrength - vibrationStrength) * vibrationFadeSpeed;

            if (!useAllControllers)
            {
                I.GamePad.SetVibration(playerIndex, vibrationStrength, vibrationStrength);

                var state = I.GamePad.GetState(playerIndex);

                var buttons = state.Buttons;
                Back.Update(buttons.Back == I.ButtonState.Pressed);
                Start.Update(buttons.Start == I.ButtonState.Pressed);
                A.Update(buttons.A == I.ButtonState.Pressed);
                B.Update(buttons.B == I.ButtonState.Pressed);
                X.Update(buttons.X == I.ButtonState.Pressed);
                Y.Update(buttons.Y == I.ButtonState.Pressed);
                LeftBumper.Update(buttons.LeftShoulder == I.ButtonState.Pressed);
                RightBumper.Update(buttons.RightShoulder == I.ButtonState.Pressed);
                LeftStickButton.Update(buttons.LeftStick == I.ButtonState.Pressed);
                RightStickButton.Update(buttons.RightStick == I.ButtonState.Pressed);

                var triggers = state.Triggers;
                LeftTrigger.Update(triggers.Left);
                RightTrigger.Update(triggers.Right);

                var dPad = state.DPad;
                DLeft.Update(dPad.Left == I.ButtonState.Pressed);
                DRight.Update(dPad.Right == I.ButtonState.Pressed);
                DDown.Update(dPad.Down == I.ButtonState.Pressed);
                DUp.Update(dPad.Up == I.ButtonState.Pressed);


                var sticks     = I.GamePad.GetState(playerIndex).ThumbSticks;
                var leftStick  = sticks.Left;
                var rightStick = sticks.Right;
                LeftStick  = new Vector2(leftStick.X, leftStick.Y);
                RightStick = new Vector2(rightStick.X, rightStick.Y);
            }
            else
            {
                I.GamePad.SetVibration(F.PlayerIndex.One, vibrationStrength, vibrationStrength);
                I.GamePad.SetVibration(F.PlayerIndex.Two, vibrationStrength, vibrationStrength);
                I.GamePad.SetVibration(F.PlayerIndex.Three, vibrationStrength, vibrationStrength);
                I.GamePad.SetVibration(F.PlayerIndex.Four, vibrationStrength, vibrationStrength);

                var state1 = I.GamePad.GetState(F.PlayerIndex.One);
                var state2 = I.GamePad.GetState(F.PlayerIndex.Two);
                var state3 = I.GamePad.GetState(F.PlayerIndex.Three);
                var state4 = I.GamePad.GetState(F.PlayerIndex.Four);

                var buttons1 = state1.Buttons;
                var buttons2 = state2.Buttons;
                var buttons3 = state3.Buttons;
                var buttons4 = state4.Buttons;
                Back.Update(buttons1.Back == I.ButtonState.Pressed || buttons2.Back == I.ButtonState.Pressed || buttons3.Back == I.ButtonState.Pressed || buttons4.Back == I.ButtonState.Pressed);
                Start.Update(buttons1.Start == I.ButtonState.Pressed || buttons2.Start == I.ButtonState.Pressed || buttons3.Start == I.ButtonState.Pressed || buttons4.Start == I.ButtonState.Pressed);
                A.Update(buttons1.A == I.ButtonState.Pressed || buttons2.A == I.ButtonState.Pressed || buttons3.A == I.ButtonState.Pressed || buttons4.A == I.ButtonState.Pressed);
                B.Update(buttons1.B == I.ButtonState.Pressed || buttons2.B == I.ButtonState.Pressed || buttons3.B == I.ButtonState.Pressed || buttons4.B == I.ButtonState.Pressed);
                X.Update(buttons1.X == I.ButtonState.Pressed || buttons2.X == I.ButtonState.Pressed || buttons3.X == I.ButtonState.Pressed || buttons4.X == I.ButtonState.Pressed);
                Y.Update(buttons1.Y == I.ButtonState.Pressed || buttons2.Y == I.ButtonState.Pressed || buttons3.Y == I.ButtonState.Pressed || buttons4.Y == I.ButtonState.Pressed);
                LeftBumper.Update(buttons1.LeftShoulder == I.ButtonState.Pressed || buttons2.LeftShoulder == I.ButtonState.Pressed || buttons3.LeftShoulder == I.ButtonState.Pressed || buttons4.LeftShoulder == I.ButtonState.Pressed);
                RightBumper.Update(buttons1.RightShoulder == I.ButtonState.Pressed || buttons2.RightShoulder == I.ButtonState.Pressed || buttons3.RightShoulder == I.ButtonState.Pressed || buttons4.RightShoulder == I.ButtonState.Pressed);
                LeftStickButton.Update(buttons1.LeftStick == I.ButtonState.Pressed || buttons2.LeftStick == I.ButtonState.Pressed || buttons3.LeftStick == I.ButtonState.Pressed || buttons4.LeftStick == I.ButtonState.Pressed);
                RightStickButton.Update(buttons1.RightStick == I.ButtonState.Pressed || buttons2.RightStick == I.ButtonState.Pressed || buttons3.RightStick == I.ButtonState.Pressed || buttons4.RightStick == I.ButtonState.Pressed);

                var triggers1 = state1.Triggers;
                var triggers2 = state2.Triggers;
                var triggers3 = state3.Triggers;
                var triggers4 = state4.Triggers;
                LeftTrigger.Update(System.Math.Min(triggers1.Left + triggers2.Left + triggers3.Left + triggers4.Left, 1));
                RightTrigger.Update(System.Math.Min(triggers1.Right + triggers2.Right + triggers3.Right + triggers4.Right, 1));

                var dPad1 = state1.DPad;
                var dPad2 = state2.DPad;
                var dPad3 = state3.DPad;
                var dPad4 = state4.DPad;
                DLeft.Update(dPad1.Left == I.ButtonState.Pressed || dPad2.Left == I.ButtonState.Pressed || dPad3.Left == I.ButtonState.Pressed || dPad4.Left == I.ButtonState.Pressed);
                DRight.Update(dPad1.Right == I.ButtonState.Pressed || dPad2.Right == I.ButtonState.Pressed || dPad3.Right == I.ButtonState.Pressed || dPad4.Right == I.ButtonState.Pressed);
                DDown.Update(dPad1.Down == I.ButtonState.Pressed || dPad2.Down == I.ButtonState.Pressed || dPad3.Down == I.ButtonState.Pressed || dPad4.Down == I.ButtonState.Pressed);
                DUp.Update(dPad1.Up == I.ButtonState.Pressed || dPad2.Up == I.ButtonState.Pressed || dPad3.Up == I.ButtonState.Pressed || dPad4.Up == I.ButtonState.Pressed);

                var sticks1    = I.GamePad.GetState(F.PlayerIndex.One).ThumbSticks;
                var sticks2    = I.GamePad.GetState(F.PlayerIndex.Two).ThumbSticks;
                var sticks3    = I.GamePad.GetState(F.PlayerIndex.Three).ThumbSticks;
                var sticks4    = I.GamePad.GetState(F.PlayerIndex.Four).ThumbSticks;
                var leftStick  = (sticks1.Left + sticks2.Left + sticks3.Left + sticks4.Left);
                var rightStick = (sticks1.Right + sticks2.Right + sticks3.Right + sticks4.Right);
                LeftStick  = new Vector2(leftStick.X, leftStick.Y).Min(1);
                RightStick = new Vector2(rightStick.X, rightStick.Y).Min(1);
            }
        }