Example #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
        public GameStateMainMenu(ContentManager c, Game1 g)
        {
            Content = c;

            inputHandler = new InputHandler ();
            buttons = new List<Sprite> ();

            game = g;

            m = new Menu(new Vector2(10, 10), new String[] { "NEW GAME", "CREDITS", "QUIT" }, new Menu.menuAction[] { playerCount, showCredits, quitGame }, 3, 1, "test-semifont.png", Content);

            bg = new Sprite("title-bg.png", Content, new Vector2(0, 0));
        }
Example #3
0
        public GameStateMars(ContentManager c, Game1 g)
        {
            Game = g;
            Content = c;

            rockMap = new RockMap(Content);

            windowRect = new Rectangle(0, 0, 1500, int.MaxValue);

            inputHandler = new InputHandler();

            drillSound = Content.Load<SoundEffect>("Drill");
            thrustSound = Content.Load<SoundEffect>("Thrust");
            drillSoundInstance = Content.Load<SoundEffect>("Drill").CreateInstance();
            drillSoundInstance.IsLooped = true;
            thrustSoundInstance = Content.Load<SoundEffect>("Thrust").CreateInstance();
            thrustSoundInstance.IsLooped = true;
            boomSound = Content.Load<SoundEffect>("Boom");

            sdSystem = new TextSystem("profont.png", Content);
            sdSystem.resetString(new Vector2(5, 725));
            sdSystem.addString("Out of energy. Press \\3ESC to self-destruct");

            bg = new Sprite("mars-bg.png", Content, new Vector2(0, 0), false);
            player = new Player("miner.png", Content, new Vector2(windowRect.Width/2, 25));
            shop = new Sprite("shop.png", Content, new Vector2(500, 25));
            deadOverlay = new Sprite("dead.png", Content, new Vector2(0, 0), false);

            otherPlayers = new Dictionary<string, Player>();

            mapOffset = new Vector2(0,-125);

            thrusters = false;
            transY = 0f;
            transX = 0f;

            drillTime = 0f;

            redTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            redTexture.SetData(new Color[] { Color.Red });
            blueTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            blueTexture.SetData(new Color[] { Color.Blue });
            greenTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            greenTexture.SetData(new Color[] { Color.Green });
            blackTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            blackTexture.SetData(new Color[] { Color.Black });
        }
        public GameStateMainMenu(ContentManager c, Game1 g)
        {
            Content = c;

            inputHandler = new InputHandler ();
            buttons = new List<Sprite> ();

            network = null;

            game = g;

            m = new Menu(new Vector2(5, 5), new String[] { "NEW GAME", "CONTROLS", "CREDITS", "QUIT" }, new Menu.menuAction[] { startGame, showControls, showCredits, quitGame }, 4, 1, "profont.png", Content);

            bg = new Sprite("excav-bg.png", Content, new Vector2(0, 0), false);
            topMask = new Sprite("excav-topmask.png", Content, new Vector2(0, 0), false);
            loadingOverlay = new Sprite("loading-overlay.png", Content, new Vector2(0, 0), false);

            string[] scrollLines = new string[] {
                "In the year 22XX",
                "A new world supply of energy is discovered.",
                "",
                "Marsium.",
                "",
                "As its name suggests, it can only be found",
                "on Mars.",
                "",
                "Within 50 years of its discovery, only one",
                "corporation controls the world supply.",
                "\\3MarsTek.",
                "",
                "You are a rookie drill technician, sent to",
                "a newly-discovered Marsium deposit far from",
                "Civilization.",
                "",
                "",
                ""};
            scrollSystems = new TextSystem[scrollLines.Length];
            for (int x = 0; x < scrollLines.Length; x++) {
                scrollSystems[x] = new TextSystem("profont.png", Content);
                scrollSystems[x].resetString(new Vector2(0, 0));
                scrollSystems[x].addString(scrollLines[x]);
                scrollSystems[x].setPosition(new Vector2(375 - scrollSystems[x].getWidth()/2, 780 + (scrollSystems[x].getHeight() + 2)*x));
                scrollSystems[x].update(1);
            }
        }
 public void setOnReady(Game1.fadeDelegate del)
 {
     onReady = del;
 }
Example #6
0
        public GameStateShop(Game1 g, ContentManager c, Inventory inv)
        {
            Game = g;
            Content = c;
            inventory = inv;
            inputHandler = new InputHandler();
            background = new Sprite("shop-bg.png", Content, Vector2.Zero, false);
            itemSystems = new TextSystem[8];
            headerSystem = new TextSystem("profont.png", Content);
            setHeader();
            descriptionSystem = new TextSystem("profont.png", Content);
            descriptionLocation = new Vector2(350, 75);

            boop = Content.Load<SoundEffect>("Boop");

            backButton = new Sprite("shop_exit.png", Content, new Vector2(25, 675), false);
            purchaseButton = new Sprite("shop_purchase.png", Content, new Vector2(575, 675), false);
            ownedButton = new Sprite("shop_alreadypurchased.png", Content, new Vector2(575, 675), false);

            energyButton = new Sprite("shop_energyrestore.png", Content, new Vector2(105, 675), false);
            hpButton = new Sprite("shop_healthrestore.png", Content, new Vector2(259, 675), false);
            sellButton = new Sprite("shop_sellcargo.png", Content, new Vector2(413, 675), false);

            yesButton = new Sprite("shop_yes.png", Content, new Vector2(25, 550), false);
            noButton = new Sprite("shop_no.png", Content, new Vector2(80, 550), false);

            poorButton1 = new Sprite("shop_poor1.png", Content, Vector2.Zero, false);
            poorButton2 = new Sprite("shop_poor2.png", Content, Vector2.Zero, false);

            confirmSystem = new TextSystem("profont.png", Content);
            action = -1;

            itemNames = new string[] {
                "Power Drill",
                "Marsium Drill",
                "Reinforced Hull",
                "Impenetrable Hull",
                "Cargo Bay Expansion",
                "Cargo Teleportation Bay",
                "TESLA Battery",
                "Fusion Reactor"};
            costs = new int[] {
                350,
                5000,
                150,
                750,
                750,
                1500,
                750,
                1250
            };
            descriptions = new string[] {
                "\\1DRILLS UP TO 2x FASTER THAN\\nYOUR STANDARD DRILL!\\0\\nMade from a lightweight alloy,\\nthis drill generates double\\nthe power from the same\\namount of energy as a\\nregular drill. Great\\nfor tearing through tough\\nbedrock and solid chunks\\nof diamond!",
                "\\1THE DRILL YOUR MOTHER WARNED\\nYOU ABOUT!\\0\\nState-of-the-art drill technology\\nand chemically treated Marsium\\nstrength combine to bring\\nto you the most powerful\\ndrill ever made. Performs\\nthe work of eight standard drills\\nand without using a single\\ndrop extra of energy.\\nBuy now! What are you, poor?",
                "\\1NEVER FEAR A HIGH FALL AGAIN!\\0\\nStandard \\3Marstek\\0(tm)\\nEXC-07 hull reinforced with\\ndiamonds to provide enhanced\\nprotection against rough\\nlandings, pockets of lava, and\\neverything inbetween.",
                "\\1THE BEST ARMOR MONEY CAN BUY!\\0\\nAfter decades of advanced\\nresearch, top \\3Marstek\\0(tm)\\nscientists have yet to find a\\nprojectile that can damage this\\nhull! Hypertrains, space\\nelevators, and even FTL particles\\nfail to leave a dent!",
                "\\1WHAT'RE YOU GONNA DO WITH ALL\\nTHAT JUNK?\\0\\nStore it in this expanded\\ncargo bay! Double the\\ncapacity of the standard\\nmodel, this cargo expansion\\nprovides all the space you\\nneed to store Marsium on\\nlong mining expeditions.",
                "\\1A WHOLE NEW MEANING OF\\nCLOUD STORAGE!\\0\\nWhy store cargo on your ship,\\nwhen you could store it\\nin our warehouse! Just\\nthrow your cargo in and\\nhit the button, and\\nyour precious cargo will be\\ninstantly transported to\\nsecure \\3MarsTek\\0(tm) storage\\nfacilities. Don't worry, we\\npromise we'll give it back!",
                "\\1THE BATTERY OF THE FUTURE!\\0\\nEver since the days of the 21st\\ncentury, men have strived to\\nbuild the ultimate battery. Now,\\n\\3MarsTek\\0(tm) has done it! This\\nbattery harnesses the power of\\nquantum entanglement to deliver\\n5x the power of any other\\nbattery on the market.",
                "\\1IS THIS THING EVEN SAFE?\\0\\nOf course it is! Why carry\\naround a bulky inefficient\\nbattery when you could suck\\npower from your very own\\nsupergiant star! Provides\\nnear-limitless energy, and\\nwill only create a black hole if\\nyou forget to clean the\\nexhaust pipe."
            };

            selectedItem = -1;

            for (int x = 0; x < 8; x++)
            {
                itemSystems[x] = new TextSystem("profont.png", Content);
                itemSystems[x].resetString(new Vector2(25, 50 + (x * 50)));
                itemSystems[x].addString(itemNames[x]);
            }
        }
 static void Main()
 {
     using (var game = new Game1())
         game.Run();
 }
        public GameStateMap(ContentManager c, Game1 g, int nP)
        {
            Content = c;
            game = g;

            week = 0;
            revenue = 0;
            unionRevenue = 0;
            funds = 0;
            unionFunds = 0;
            ownedCounties = 1;

            multiPlayer = (nP == 2);
            playerNumber = 1;
            enemyNumber = 2;

            selectingForAttack = 0;
            selectingForTroopTransfer = 0;
            selectingForRecruitment = false;

            actionMenu = null;
            gpWindow = null;

            playerNames = new string[] { "\\0UNOCCUPIED", "\\3CHRISTIE\\0", "\\4UNION\\0" };

            beginning = true;
            beginningSelector = 1;
            beginningTextWindow = new TextWindow(new String[] { playerNames[1] + " SELECT A COUNTY" },
                Content, new Vector2(25, 25), new Vector2(500, 25));

            inputHandler = new InputHandler();

            countyNames = new string[] {
                "Atlantic", "Bergen", "Burlington", "Camden", "Cape May", "Cumberland", "Essex",
                "Gloucester", "Hudson", "Hunterdon", "Mercer", "Middlesex", "Monmouth","Morris",
                "Ocean", "Passaic", "Salem", "Somerset", "Sussex", "Union", "Warren"};
            countyRevenues = new int[]
            { 27,42,34,29,33,21,31,31,31,48,36,33,40,47,29,26,27,47,35,34,32 };
            countyPopulations = new int[]
            { 274,905,448,513,97,156,783,288,634,128,366,809,630,492,576,501,66,323,149,536,108 };

            countyGraph = new int[][]
            {
                new int[] {2,3,4,5,7}, // Atlantic
                new int[] {6,8,15}, // Bergen
                new int[] {10,12,0,3,14}, // Burlington
                new int[] {0,2,7}, // Camden
                new int[] {0,5}, // Cape May
                new int[] {4,0,16,7}, // Cumberland
                new int[] {1,8,15,19,13}, // Essex
                new int[] {16,3,5,0}, // Gloucester
                new int[] {1,6}, // Hudson
                new int[] {20,13,17,10}, // Hunterdon
                new int[] {9,17,11,12,2}, // Mercer
                new int[] {19,17,10,12}, // Middlesex
                new int[] {10,11,2,14}, // Monmouth
                new int[] {18,15,6,19,17,9,20}, // Morris
                new int[] {12,2}, // Ocean
                new int[] {13,6,1,18}, // Passaic
                new int[] {7,5}, // Salem
                new int[] {13, 19, 11, 10, 9}, // Somerset
                new int[] {15,13,20}, // Sussex
                new int[] {6,13,17,11}, // Union
                new int[] {18,13,9} // Warren
            };

            labelOffsets = new Vector2[]
            {
                new Vector2(-30,0), // Atlantic
                new Vector2(-10,-10), // Bergen
                new Vector2(-15,-20), // Burlington
                new Vector2(-120, -70), // Camden
                new Vector2(30, 0), // Cape May
                new Vector2(0,0), // Cumberland
                new Vector2(-23, -20), // Essex
                new Vector2(-30, -20), // Gloucester
                new Vector2(10, -10), // Hudson
                new Vector2(-20, -20), // Hunterdon
                new Vector2(-30, -10), // Mercer
                new Vector2(-40, 0), // Middlesex
                new Vector2(0, -5), // Monmouth
                new Vector2(-20, -5), // Morris
                new Vector2(-40, -40), // Ocean
                new Vector2(0, -70), // Passaic
                new Vector2(-40, -35), // Salem
                new Vector2(-30, 0), // Somerset
                new Vector2(-40, -20), // Sussex
                new Vector2(30, 5), // Union
                new Vector2(-100, -10) // Warren
            };

            counties = new County[countyNames.Length];
            individualCounty = null;
            icTextWindow = null;

            int x = 0;
            foreach (string co in countyNames) // load county sprites
            {
                Sprite s = new Sprite(co + ".png", Content, new Vector2(650, 600));
                s.position = new Vector2(650 - s.boundingRectangle.Width, 600 - s.boundingRectangle.Height);
                Sprite sfull = new Sprite(co + "-full.png", Content, new Vector2(0, 0));
                counties[x] = new County(co, s, sfull, countyRevenues[x], countyPopulations[x], countyGraph[x++]);
            }

            troopLabels = new TextWindow[21];
            updateGameLabels();
        }