public void LoadWorld(IWorldLoader loader) { _loader = loader; loader.LoadMap(_world); _tileRenderer.Configure(_loader); _tileRenderer.Setup(_world); }
public MainViewModel(IWorldLoader worldLoader) { _worldLoader = worldLoader; OpenCommand = new RelayCommand(DoOpenCommand); PackCommand = new RelayCommand(() => _worldLoader.WriteSections(_sections, _fileName)); }
public void LoadWorld(IWorldLoader loader) { _loader = loader; loader.LoadMap(_world); _tileRenderer.Configure(_loader); _tileRenderer.Setup(_world); }
public AdminController( IImportReader importReader, IAnalyticsWriter analyticsWriter, IAnalyticsReader analyticsReader, IRunIndexer runIndexer, IAnalyticsModule analyticsModules, IWorldFinder worldFinder, IWorldArchivist worldArchivist, IWorldLoader worldLoader, IWorldDeleter worldDeleter, IMapRenderModule mapRenderer, IRenderQueue renderQueue) { _importReader = importReader; _analyticsReader = analyticsReader; _analyticsWriter = analyticsWriter; _runIndexer = runIndexer; _analyticsModules = analyticsModules; _worldFinder = worldFinder; _worldArchivist = worldArchivist; _worldLoader = worldLoader; _worldDeleter = worldDeleter; _mapRenderer = mapRenderer; _renderQueue = renderQueue; }
public void Configure(IWorldLoader loader) { TileWidth = loader.TileWidth; TileHeight = loader.TileHeight; TileStepX = TileWidth; TileStepY = TileHeight / 4; OddRowXOffset = TileWidth / 2; HeightTileOffset = TileHeight; }
public Game(IGameBoundaries boundaries) { _inputManager = boundaries.InputManager; _logger = boundaries.Logger; _physicsEngine = boundaries.PhysicsEngine; _renderer = boundaries.Renderer; _worldLoader = boundaries.WorldLoader; _eventBus = boundaries.EventBus; World = _worldLoader.LoadWorld(); }
public World(Game1 game, IWorldLoader worldLoader) { this.Game = game; this._wl = worldLoader; // Create a new content manager to load content used just by this World. this._contentManager = new ContentManager(game.Services, "Content"); var gameItems = worldLoader.GetGameObjects(this).ToList(); this.GameObjects = new GameObjectCollection(worldLoader.Width, worldLoader.Height, gameItems); this.Player = gameItems.OfType<Player>().Single(); this._itemsToDrawByZOrder = new List<StaticItem>[10]; for (int i = 0; i < this._itemsToDrawByZOrder.GetLength(0); i++) this._itemsToDrawByZOrder[i] = new List<StaticItem>(); }
public void StartLevel(IWorldLoader worldLoader) { ctx.Score = new Score(); Entity player = CreatePlayer(worldLoader.PlayerStartVector); ctx.Player = (PlayerBehaviour)player.Behavior; ctx.World = worldLoader.LoadWorld(ctx); ctx.World.CurrentScene.AddEntity(player); ctx.Camera.Target = player; ctx.Camera.Update(); ctx.Renderer.RebuildTerrainMesh(); }
public WorldLoaderModule( IWorldSearcher worldFinder, IWorldLoader worldLoader, IImportReader importReader, IServerPropertiesReader serverPropReader, ILogger <WorldLoaderModule> logger) { _worldFinder = worldFinder; _worldLoader = worldLoader; _importReader = importReader; _logger = logger; try { _serverProperties = serverPropReader.Read(); } catch (ServerPropertiesNotFoundException ex) { _logger.LogWarning(ex, "Candidate Check is unable to read server.properties. Skipping last world on import assuming it is the active one."); } }
internal Game1(IPlayerInput playerInput, IWorldLoader worldLoader) { if (playerInput == null) throw new ArgumentNullException("playerInput"); if (worldLoader == null) throw new ArgumentNullException("worldLoader"); this.PlayerInput = playerInput; this.PlayerInput.GameInput = new GameInput(this); this._worldLoader = worldLoader; this._gdm = new GraphicsDeviceManager(this) { PreferredBackBufferWidth = RoomSizeWidth * ZoomWhilstWindowed, PreferredBackBufferHeight = RoomSizeHeight * ZoomWhilstWindowed }; this.Content.RootDirectory = "Content"; //this.TargetElapsedTime = new TimeSpan(this.TargetElapsedTime.Ticks * 4); this._lives = 2; this._score = 0; this._displayedScore = 0; this.SoundPlayer = new NullSoundPlayer(); }
public World([NotNull] IWorldLoader worldLoader, [NotNull] string world) { worldLoader.LoadWorld(world); this._worldSize = worldLoader.WorldSize; this._tiles = worldLoader.FloorTiles; this._restartInSameRoom = worldLoader.RestartInSameRoom; this._playerStartStates = worldLoader.PlayerStartStates; var boundMovementFactory = new BoundMovementFactory(this._worldSize); GlobalServices.SetBoundMovementFactory(boundMovementFactory); var gameObjectCollection = new GameObjectCollection(worldLoader.WorldSize); var gameState = new GameState(gameObjectCollection); GlobalServices.SetGameState(gameState); worldLoader.AddGameObjects(gameState); this._player = gameState.Player; this._worldClock = new WorldClock(); if (worldLoader.UnlockLevels) { this._worldClock.AddEventHandler(new UnlockLevel(this)); } foreach (var dist in worldLoader.FruitDistributions.Where(item => item.PopulationMethod.WillReplenish())) { var replenishFruit = new ReplenishFruit(dist); this._worldClock.AddEventHandler(replenishFruit); } this._worldWindow = new WorldWindow(); GlobalServices.SetCentrePointProvider(this._worldWindow); ValidateGameState(gameState); Messenger.Default.Register <WorldCompleted>(this, WorldCompleted); Messenger.Default.Register <LifeLost>(this, LostLife); }
public void ChangeLoader(NetType netType) { if (_worldLoader != null) { _worldLoader.Stop(); _worldLoader.Dispose(); } if (editorMode) { _worldLoader = new EditorWorldLoader(this); } else { if (netType == NetType.Single) { _worldLoader = new SingleWorldLoader(this); } else { _worldLoader = new NetWorldLoader(this); } } }
public void Configure(IWorldLoader loader) { TileWidth = loader.TileWidth; TileHeight = loader.TileHeight; TileStepX = TileWidth; TileStepY = TileHeight / 4; OddRowXOffset = TileWidth / 2; HeightTileOffset = TileHeight; }