private static readonly Logger Logger = LogManager.CreateLogger(); // logging-facility. /// <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); }
/// <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 blockStorage = new BlockStorage(this.Game); this.Game.Components.Add(blockStorage); 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 }); }