Example #1
0
        /// <summary>
        /// Creates a new world.
        /// </summary>
        /// <param name="game"> </param>
        /// <param name="chunkStorage"> </param>
        /// <param name="chunkCache"> </param>
        public World(Game game, ChunkStorage chunkStorage, ChunkCache chunkCache)
            : base(game)
        {
            this.Chunks = chunkStorage;
            this._chunkCache = chunkCache;

            // export services.
            this.Game.Services.AddService(typeof (IWorld), this);
        }
Example #2
0
        /// <summary>
        /// Adds game-components.
        /// </summary>
        private void AddComponents()
        {
            this.Components.Add(new InputManager(this));

            this.Components.Add(new AssetManager(this));

            #if XNA
            this.Components.Add(new Sky(this));
            #endif

            this.Components.Add(new Fogger(this));

            var chunkStorage = new ChunkStorage(this);
            this.Components.Add(chunkStorage);

            var vertexBuilder = new VertexBuilder(this);
            this.Components.Add(vertexBuilder);

            var chunkCache = new ChunkCache(this);
            this.Components.Add(chunkCache);

            var world = new World(this, chunkStorage, chunkCache);
            this.Components.Add(world);

            this.Components.Add(new Player(this, world));

            #if XNA
            bloom = new BloomComponent(this);
            this.Components.Add(bloom);
            #endif

            this.Components.Add(new Camera(this));
            this.Components.Add(new UserInterface(this));

            this.Components.Add(new InGameDebugger(this));
            this.Components.Add(new Statistics(this));
            this.Components.Add(new GraphManager(this));

            #if XNA
            this.Components.Add(new AudioManager(this));
            #endif

            this._timeRuler = new TimeRuler(this);
            this._timeRuler.Visible = true;
            this._timeRuler.ShowLog = true;
            this.Components.Add(this._timeRuler);
        }
Example #3
0
        /// <summary>
        /// Adds game-components.
        /// </summary>
        private void AddComponents()
        {
            this.Rasterizer = new Rasterizer();

            this.Game.Components.Add(new InputManager(this.Game));

            this.Game.Components.Add(new AssetManager(this.Game));

            #if XNA
            //this.Game.Components.Add(new Sky(this.Game));
            #endif

            this.Game.Components.Add(new NewSky(this.Game));

            this.Game.Components.Add(new Fogger(this.Game));

            var chunkStorage = new ChunkStorage(this.Game);
            this.Game.Components.Add(chunkStorage);

            var vertexBuilder = new VertexBuilder(this.Game);
            this.Game.Components.Add(vertexBuilder);

            var chunkCache = new ChunkCache(this.Game);
            this.Game.Components.Add(chunkCache);

            var world = new World(this.Game, chunkStorage, chunkCache);
            this.Game.Components.Add(world);

            this.Game.Components.Add(new Player(this.Game, world));

            this.Game.Components.Add(new Camera(this.Game));
            this.Game.Components.Add(new UserInterface(this.Game));

            this.Game.Components.Add(new InGameDebugger(this.Game));
            this.Game.Components.Add(new DebugBar(this.Game));
            this.Game.Components.Add(new GraphManager(this.Game));

            #if XNA
            this.Game.Components.Add(new AudioManager(this.Game));
            #endif

            var spriteBatch = new SpriteBatch(this.Game.GraphicsDevice);
            Console = new GameConsole(this.Game, spriteBatch,  new GameConsoleOptions
                                                             {
                                                                 Font = Game.Content.Load<SpriteFont>(@"Fonts/Verdana"),
                                                                 FontColor = Color.LawnGreen,
                                                                 Prompt = ">",
                                                                 PromptColor = Color.Crimson,
                                                                 CursorColor = Color.OrangeRed,
                                                                 BackgroundColor = Color.Black*0.8f,
                                                                 PastCommandOutputColor = Color.Aqua,
                                                                 BufferColor = Color.Gold
                                                             });
        }