Update() public method

public Update ( ) : void
return void
Ejemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            var deltaSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds;

            FPS.Update(deltaSeconds);
            Garbage.Update(deltaSeconds);

            if (_fpsOrGarbageDirty)
            {
                _fpsOrGarbageDirty = false;
                Game.Window.Title  = $"FPS {_fps} | Garbage per sec KB {_garbage.ToString(CultureInfo.InvariantCulture)}";
            }
        }
Ejemplo n.º 2
0
        void Update()
        {
            fps.Update();

            if (Time.realtimeSinceStartup - homeButtonTime < homeInterval)
            {
                return;
            }
            if (Input.GetKey(KeyCode.Home))
            {
                homeButtonTime = Time.realtimeSinceStartup;
                isShowThis     = !isShowThis;
            }
        }
Ejemplo n.º 3
0
        public override void Update()
        {
            fps.Update();
            var zoom = Input.GetKey(Keyboard.Key.Hyphen) - Input.GetKey(Keyboard.Key.Equal);

            camZoom += zoom * (0.001f * zoomSpeed);
            camZoom  = Math.Clamp(camZoom, 0.1f, 0.28f);

            if (Input.GetKeyDown(Keyboard.Key.Backspace, true))
            {
                camZoom = 0.2f;
            }

            cameraView.Center = new Vector2f(target.X, target.Y);

            var x        = (float)Math.Floor(target.X);
            var y        = (float)Math.Floor(target.Y + 15);
            var fpsText  = $"FPS: {fps.GetFPS()}\n";
            var position = $"X: {x}, Y: {y}\n";

            hudText.DisplayedString = fpsText + position;
        }
Ejemplo n.º 4
0
    void Update()
    {
        // update Arcball on mouse
        if (Input.GetMouseButton(0))
        {
            mArcball.update(Input.mousePosition);
            this.transform.rotation = mArcball.getRotation();
        }
        else if (Input.GetMouseButtonUp(0))
        {
            mArcball.stop();
        }
        else if (Input.GetKeyDown(KeyCode.H))
        {
            mArcball.reset();
        }
        else if (Input.GetKeyDown(KeyCode.G))
        {
            bGuiVisible = !bGuiVisible;
        }

        // get scroll amount
        float scroll = Input.GetAxis("Mouse ScrollWheel");

        if (scroll > 0.0f || scroll < 0.0f)
        {
            fov += -Input.GetAxis("Mouse ScrollWheel") * fovSensitivity;

            switch (selectedModelID)
            {
            case LensModel.LENSMODEL.RECTILINEAR:
                minFov = 1;
                maxFov = 179;
                break;

            case LensModel.LENSMODEL.EQUIDISTANT:
                minFov = 1;
                maxFov = 220;
                break;

            case LensModel.LENSMODEL.STEREOGRAPHIC:
                minFov = 1;
                maxFov = 359;
                break;

            case LensModel.LENSMODEL.EQUIRECTANGULAR:
                minFov = 360;
                maxFov = 360;
                break;

            case LensModel.LENSMODEL.CYLINDRICAL:
                minFov = 1;
                maxFov = 179;
                break;

            default:
                minFov = maxFov = 360;
                break;
            }

            fov = Mathf.Clamp(fov, minFov, maxFov);

            UpdateFOV();
        }

        mFps.Update();

        if (!renderLast)
        {
            UpdateCubemap(63);
        }
    }
Ejemplo n.º 5
0
        protected override void Update(GameTime gameTime)
        {
            Camera.Update(gameTime);

            /*
             * if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
             *  Keyboard.GetState().IsKeyDown(Keys.Escape))
             *  Exit();
             */

            // Mouse
            //ToDo 1 Fix mouse getting 'stuck' in fullscreen mode
            MouseCoordinates = Cursor.GetMouseCoordinates();
            Cursor.GetMouseCoordinates();
            Cursor.UpdateCursorRectangleLocation();

            //Update Tree Foliage Transparency
            Trees.ChangeTreeFoliageTransparency();


            if (Debug.Debug.IsDebugEnabled)
            {
                fps.Update(gameTime);
            }


            if (ResolutionChanged)
            {
                ResolutionHandler.SetResolution();
                Graphics.ApplyChanges();
            }


            Camera.Position = CameraPosition;


            #region User Interface

            if (BuildMenuPane.IsBuildMenuWindowVisible)
            {
                BuildMenuRollOverText.GenerateRollOverText();
                BuildMenuPane.CloseBuildMenu();
            }


            if (BuildingPlacementHandler.IsPlacingBuilding)
            {
                BuildingPlacementHandler.CheckIfGroundClear(Blueprint);
                BuildingPlacementHandler.PlaceAStructure(BuildingPlacementHandler.SetBuildingTexture());
            }


            //Menu
            if (!Bulldozer.IsBulldozerActive)
            {
                BuildMenuInteraction.CheckCursorMenuInteraction(Cursor.CursorRectangle);
            }

            if (BuildMenuInteraction.IsBuildMenuOpen && !Bulldozer.IsBulldozerActive)
            {
                BuildMenuInteraction.CheckBuildIconInteraction();
            }

            if (BuildMenuPane.IsBuildMenuWindowVisible && !Bulldozer.IsBulldozerActive)
            {
                BuildMenuPane.UpdateBuildMenuWindowLocation();
            }


            // Details Pane
            DetailsPaneInteraction.CheckForDetailsPaneInteraction();
            DetailsPaneMovement.UpdateDetailsPaneLocation();

            // Selected Pawn
            if (SelectedPawn.SelectedHuman != null)
            {
                SelectedPawn.UpdateIndicator(SelectedPawn.SelectedHuman);
                ExtendIconChecks.CheckExtendHandClicked();
                PawnInfo.UpdatePawnInfo();
            }
            #endregion

            #region PawnInfoSB
            PawnCursorInteraction.CheckForCursorPawnInteraction();

            if (PawnInfo.IsPawnInfoVisible)
            {
                PawnInfo.ClosePawnInfo();
            }

            if (ExtendIconChecks.IsWeaponIconListVisible)
            {
                EquipWeapon.CheckWeaponIconInteraction();
                CreateItemIcons.UpdateWeaponIconList();
            }

            #endregion

            ZedDeath.CheckZedsHealth();
            RuinedBuilding.CheckBuildingsHealth();
            HumanDeath.CheckHumansHealth();

            ZedController.IncreaseZeds();


            //Building Removal
            if (Bulldozer.IsBulldozerActive)
            {
                Bulldozer.DemolishStructure();
            }

            //Movement
            //HumanMovement.RunFromZeds();
            PathFind.MovePawns();


            CheckMouseStateChange.UpdateMouseState();
            KeyBindings.CheckForKeyInput();
            KeyBindings.CheckForMouseInput();

            Resource.SetResourcesForGathering();


            base.Update(gameTime);
        }