Update() private method

private Update ( ) : void
return void
Esempio n. 1
0
        public static void Update()
        {
            Collision.Update();
            Pause.Update();

            // Start Menu
            if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.Start)
            {
                Objects.menu.Update();
            }

            // Settings menu
            if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.Settings)
            {
                Objects.settings.Update();
            }


            // Map select
            else if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.Maps)
            {
                Objects.maps.Update();
            }

            // In Game
            else if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.InGame)
            {
                // statics
                Shoot.Update();
                Zombie_manager.Update();
                Shops.Update();
                Highscore.Update();

                // Objects
                Objects.bullets.Update();
                Objects.player.Update();
                Objects.weapon.Update();
            }
            Objects.camera.UpdateCamera(Objects.View);
        }
Esempio n. 2
0
        public GameMode Update()
        {
            this.menuButton.Update(); // Was menu button clicked
            if (loaded_controls != null && userControls == null)
            {
                getUserControls();
            }
            //Update user control menu buttons
            UserControl updatedControl = this.controlEditing;

            updatedControl = Left.Update(updatedControl, userControls.SingleOrDefault(x => x.control == UserControl.Left));
            updatedControl = Right.Update(updatedControl, userControls.SingleOrDefault(x => x.control == UserControl.Right));
            updatedControl = Shoot.Update(updatedControl, userControls.SingleOrDefault(x => x.control == UserControl.Shoot));

            //check for updated user controls
            if (controlEditing != UserControl.None && updatedControl != controlEditing)
            {
                var cntrl = userControls.Single(x => x.control == controlEditing);

                // if user control was just unselected, update the key
                if (controlEditing == UserControl.Left)
                {
                    userControls.Single(x => x.control == controlEditing).key = this.Left.newKey;
                }
                else if (controlEditing == UserControl.Right)
                {
                    userControls.Single(x => x.control == controlEditing).key = this.Right.newKey;
                }
                else if (controlEditing == UserControl.Shoot)
                {
                    userControls.Single(x => x.control == controlEditing).key = this.Shoot.newKey;
                }
                saveControls();
            }
            controlEditing = updatedControl;

            return(this.menuButton.isClicked ? GameMode.Menu : GameMode.CustomizeControls);
        }