예제 #1
0
        public void ResetGame()
        {
            #region Reset Player
            //Reset player. will update width and length when image is present
            Texture2D temp = play.Image;
            play = new Player("Player", new Rectangle(5, 5, 25, 25));
            play.Image = temp;
            #endregion

            #region Reset Rows / Columns
            currentCol = 0;
            currentRow = 0;
            #endregion

            #region Reset gameState
            //Reset enum
            gameState = States.titleMenu;
            #endregion

            #region Reset objectList
            //Creates an object list to hold the objects currently on screen
            objectList = new List<Object>();
            #endregion

            #region IReset mapManager
            mapManager = new MapManager();
            #endregion

            bool newRow = true;
            List<InventoryItem> shopItems = new List<InventoryItem>();
            #region Adds MapNodes to the MapManager
            //Adding MapNodes to the MapManager
            Random rand = new Random();
            int rows = rand.Next(6, 8);
            int cols = rand.Next(7, 9);
            for (int i = 1; i < rows; i++)
            {
                for (int j = 1; j < cols; j++)
                {
                    if (j > 1)
                        newRow = false;
                    mapManager.AddNode(newRow, mapImage, islandImages, fishingImage, stormImage, pirateImage, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, shopItems, play);
                }
                newRow = true;
            }
            #endregion
        }
예제 #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            #region Initialize Player
            //initialize player. will update width and length when image is present
            play = new Player("Player", new Rectangle(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 25, 25));
            #endregion

            #region Initialize Rows / Columns
            currentCol = 0;
            currentRow = 0;
            #endregion

            #region Initialize gameState
            //initialize enum
            gameState = States.titleMenu;
            #endregion

            #region Initialize objectList
            //Creates an object list to hold the objects currently on screen
            objectList = new List<Object>();
            #endregion

            #region Initialize UImanager
            //initialize manager
            ShopUImanager = new UI_manager();
            TitleUIManager = new UI_manager();
            ControlUIManager = new UI_manager();
            OverUIManager = new UI_manager();
            FishingUI = new UI_manager();
            InventoryUIManager = new UI_manager();
            #endregion

            #region Initialize mapManager
            mapManager = new MapManager();
            #endregion

            #region Initialize islandImages
            islandImages = new List<Texture2D>();
            #endregion

            #region Creates the fullscreen effect
            Window.Position = new Point(0, 0);
            Window.IsBorderless = true;
            graphics.PreferredBackBufferWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
            graphics.PreferredBackBufferHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
            graphics.ApplyChanges();
            #endregion

            //start external tool
            //Process.Start("C:/Users/Jeffrey Karger/Desktop/scrublords/GameObject/FileChecker/bin/Debug/FileChecker.exe");
            DirectoryInfo di = new DirectoryInfo(".");

            //ProcessStartInfo info = new ProcessStartInfo();
            //info.WorkingDirectory = "../../../../FileChecker/bin/Debug/";
            //info.FileName = "FileChecker.exe";
            //info.UseShellExecute = false;
            //Process.Start(info);
            Process.Start(di.FullName + "/../../../../FileChecker/bin/Debug/FileChecker.exe");


            base.Initialize();
        }