Esempio n. 1
0
 // check the traversibility of a square on the grid
 public void Update(ReachableArea reachableArea)
 {
     reach = reachableArea;
 }
Esempio n. 2
0
 // The public instance class
 public Path(ReachableArea reachable)
 {
     this.reach = reachable;
 }
Esempio n. 3
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // grid & camera
            isoGrid = new IsoGrid(GraphicsDevice,Math.PI/6.0,30,new Vector2(100,100));
            cameraPosition = isoGrid.cameraCentre(new Vector2(11,12),graphics); // initial camera position!
            scrollSpeed = 10.0f;

            // fonts
            font = Content.Load<SpriteFont>("font");

            // cursor
            cursor = new Cursor(Content.Load<Texture2D>("cursor"));

            // HUD
            buttons = new List<Button> { };

            // random seed
            random = new Random();

            // spacescape
            tiles = new GridTileRegion(Content.Load<Texture2D>("starTiles"), new Vector2(-1, 0),new Vector2(100,100), isoGrid,random);

            // --- game objects ----------

            // ships
            trader = new Ship("Trading Ship", Content.Load<Texture2D>("cargoShip"));
            transport = new Ship("Transport Ship", Content.Load<Texture2D>("cargoShip"));

            // materials
            metal = new Material("Metal");
            rock = new Material("Rock");
            gems = new Material("Gemstones");

            // buildings
            dwellBlock = new Building("Dwelling Block",Content.Load<Texture2D>("building2"),3,new Vector2(0,0),new Vector2(1,1));
            dwellBlockLarge = new Building("Large Dwelling Block",Content.Load<Texture2D>("building5"), 3, new Vector2(0, 0), new Vector2(1, 1));
            govTower = new Building("Goverment Central Tower",Content.Load<Texture2D>("building3"), 1, new Vector2(0, 0), new Vector2(3, 3));
            hugeGovTower = new Building("Huge Governemnt Central Tower", Content.Load<Texture2D>("hugeGovernmentTower"), 1, new Vector2(0, 0), new Vector2(12, 12));
            Factory = new Building("Factory",Content.Load<Texture2D>("building4"), 2, new Vector2(0, 0), new Vector2(2, 1));
            Arena = new Building("Entertainment Arena",Content.Load<Texture2D>("building1"), 1, new Vector2(0, 0), new Vector2(2, 2));

            // cities

            modCity = new ModCity("Customisable City", Content.Load<Texture2D>("smallcity"), Content.Load<Texture2D>("smallcityHigh"), Content.Load<Texture2D>("smallcityClick"), new Vector2(20, 3),new Vector2(20, 85),8, isoGrid, new Tuple<float, float, float>(0.33f, 0.33f, 0.34f), new List<Ship> { trader }, new List<Material> { metal }, new List<Tuple<Building, int>> { new Tuple<Building, int>(dwellBlock, 4), new Tuple<Building, int>(dwellBlockLarge, 4), new Tuple<Building, int>(govTower, 1), new Tuple<Building, int>(Arena, 1),new Tuple<Building,int>(Factory,3) }, GraphicsDevice, random);
            modCity2 = new ModCity("Another Customisable City", Content.Load<Texture2D>("smallcity"), Content.Load<Texture2D>("smallcityHigh"), Content.Load<Texture2D>("smallcityClick"), new Vector2(30, 5),new Vector2(20, 85),8, isoGrid, new Tuple<float, float, float>(0.33f, 0.33f, 0.34f), new List<Ship> { trader }, new List<Material> { metal }, new List<Tuple<Building, int>> { new Tuple<Building, int>(dwellBlock, 4), new Tuple<Building, int>(dwellBlockLarge, 4), new Tuple<Building, int>(govTower, 1), new Tuple<Building, int>(Arena, 1), new Tuple<Building, int>(Factory, 3) }, GraphicsDevice, random);
            homeModCity = new ModCity("Home Customisable City", Content.Load<Texture2D>("smallcity"), Content.Load<Texture2D>("smallcityHigh"), Content.Load<Texture2D>("smallcityClick"), new Vector2(10, 10),new Vector2(20, 85),8, isoGrid, new Tuple<float, float, float>(0.33f, 0.33f, 0.34f), new List<Ship> { trader }, new List<Material> { metal }, new List<Tuple<Building, int>> { new Tuple<Building, int>(dwellBlock, 4), new Tuple<Building, int>(dwellBlockLarge, 4), new Tuple<Building, int>(govTower, 1), new Tuple<Building, int>(Arena, 1), new Tuple<Building, int>(Factory, 3) }, GraphicsDevice, random, true);
            hugeCity = new ModCity("Huge City", Content.Load<Texture2D>("hugecity"), Content.Load<Texture2D>("hugecityHigh"), Content.Load<Texture2D>("hugecityClick"), new Vector2(30, 30), new Vector2(-100,280), 90, isoGrid, new Tuple<float, float, float>(0.30f, 0.30f, 0.4f), new List<Ship> { trader }, new List<Material> { metal }, new List<Tuple<Building, int>> {new Tuple<Building, int>(hugeGovTower,1), new Tuple<Building, int>(dwellBlock, 1000), new Tuple<Building, int>(dwellBlockLarge, 400), new Tuple<Building, int>(govTower, 1), new Tuple<Building, int>(Arena, 50), new Tuple<Building, int>(Factory, 300) }, GraphicsDevice, random);
            fullCity = new ModCity("A Full City", Content.Load<Texture2D>("smallcity"), Content.Load<Texture2D>("smallcityHigh"), Content.Load<Texture2D>("smallcityClick"), new Vector2(10, 15), new Vector2(7, 90), 9, isoGrid, new Tuple<float, float, float>(0.33f, 0.33f, 0.34f), new List<Ship> { trader }, new List<Material> { metal }, new List<Tuple<Building, int>> { new Tuple<Building, int>(dwellBlock, 64)}, GraphicsDevice, random);

            modCities = new List<ModCity> { modCity, modCity2,homeModCity,hugeCity,fullCity };

            universe = new DeadObject(Content.Load<Texture2D>("universe"), new Vector2(90, 94), isoGrid);
            uiball = new DeadUIObject(Content.Load<Texture2D>("rball"), new Vector2(10, 10));

            // accesible region and paths
            reach = new ReachableArea(isoGrid, modCities);
            path = new Path(reach);
        }