Ejemplo n.º 1
0
        public RealGame(int numberOfSections, int numPlayers, BlockBasedSceneGraph sceneGraph)
        {
            // setup
            Globals.gameInstance = this;
            this.sceneGraph      = sceneGraph;

            // object to store collisions (the size of the world)
            cellCollider = new CellCollider(32, numberOfSections * 32);

            // holds links between current spawn populations, doors and lights
            campaignManager = new CampaignManager(numberOfSections);

            // now build all the shit
            WorldBuilder.Build(numberOfSections, Vector3.Zero);

            // now spawn all player
            players = new PlayerObject[numPlayers];
            for (int i = 0; i < numPlayers; i++)
            {
                players[i] = new PlayerObject((i == 0) ? PlayerIndex.One : PlayerIndex.Two, playerColours[i], spawns[i], MathHelper.ToRadians(-90));
            }

            Globals.audioManager.SwitchToGame();
            //Globals.audioManager.PlayGameSound("start_game");
            Globals.audioManager.PlayGameSound("music");
        }
Ejemplo n.º 2
0
        protected override void LoadContent()
        {
            base.LoadContent();

            var worldBuilder = new WorldBuilder();
            var world        = worldBuilder.Build(new WorldDefinition(56, 70));

            for (var x = 0; x < world.Size.Width; x++)
            {
                for (var y = 0; y < world.Size.Height; y++)
                {
                    var data             = world.Get(x, y);
                    var heightColor      = Color.Lerp(Color.White, Color.Black, data.Height);
                    var temperatureColor = Color.Lerp(Color.Blue, Color.Red, data.Temperature);
                    var moistureColor    = Color.Lerp(Color.Yellow, Color.Green, data.Moisture);

                    HeightRenderer.Register(new TileControl(new Vector2(x * 8, y * 8), heightColor));
                    TemperatureRenderer.Register(new TileControl(new Vector2(x * 8, y * 8), temperatureColor));
                    MoistureRenderer.Register(new TileControl(new Vector2(x * 8, y * 8), moistureColor));
                }
            }
        }
Ejemplo n.º 3
0
 protected override void LoadContent()
 {
     World = WorldBuilder.Build();
 }