Example #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            SpriteBatch.Begin(Camera);

            RenderBackground.DrawBackground();
            GrassTufts.DrawGrassTufts();
            Bushes.DrawBushes();

            DrawHumanPawns.DrawHumans();
            DrawZedPawns.DrawZeds();

            DrawStructures.DrawBuildings();
            RuinedBuilding.DrawRuinedBuildings();

            Trees.DrawTrees();
            Trees.DrawTreeFoliage();
            Resource.DrawGatherIcon();

            HealthBar.DrawHealthBar();


            //Build Menus
            if (BuildMenuPane.IsBuildMenuWindowVisible)
            {
                DrawBuildMenus.DrawBuildMenuPane();
                DrawBuildMenus.DrawMainMenuIcons();
            }

            if (BuildMenuPane.IsBuildMenuWindowVisible && BuildMenuInteraction.IsBuildMenuOpen)
            {
                DrawBuildMenus.DrawBuildMenuIcons();
            }

            if (BuildMenuRollOverText.IsBuildMenuRollOverTextVisible)
            {
                BuildMenuRollOverText.DrawRolloverText(BuildMenuRollOverText.RollOverTxt);
            }


            //Building Placement
            if (BuildingPlacementHandler.IsPlacingBuilding)
            {
                if (BuildingPlacementHandler.CheckIfGroundClear(Blueprint))
                {
                    SpriteBatch.Draw(BuildingPlacementHandler.SetBuildingTexture(), MouseCoordinates, Color.Green);
                }
                else
                {
                    SpriteBatch.Draw(BuildingPlacementHandler.SetBuildingTexture(), MouseCoordinates, Color.Red);
                }
            }


            //Pawn PawnInfoSB
            if (PawnInfo.IsPawnInfoVisible)
            {
                //PawnInfoMenuClose.ClosePawnInfoMenu();
                DrawPawnsInfoPanel.DrawPawnInfoPanel();
                SelectedPawn.DrawSelectedPawnIndicator();
            }
            if (ExtendIconChecks.IsWeaponIconListVisible)
            {
                DrawPawnInfoIcons.DrawWeaponListIcons();
            }


            //Pawn rollover text
            DrawDetailPane.DrawDetailsPane();
            if (DetailsPane.isDetailPaneVisible)
            {
                DrawDetailPane.DrawDetailsPaneText();
            }

            if (!Bulldozer.IsBulldozerActive)
            {
                Cursor.DrawCursor();
            }
            else
            {
                Cursor.DrawDozerCursor();
            }


            if (Zeds.Debug.Debug.IsDebugEnabled)
            {
                Zeds.Debug.Debug.DrawDebugInfo();
                fps.DrawFps();
            }

            SpriteBatch.End();

            base.Draw(gameTime);
        }
Example #2
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);
        }