public void Setup() { IGameboard gameboard = new Gameboard(); GameboardConfiguration gameboardConfig = Resources.Load <GameboardConfiguration>("Gameboard Configuration"); gameboard.Initialise(gameboardConfig); ServiceLocator.Instance.ProvideService <IGameboard>(gameboard); this.configService = new BuildingConfigurationService(); ServiceLocator.Instance.ProvideService <IBuildingConfigurationService>(this.configService); ServiceLocator.Instance.ProvideService <IBuildingVisualFactory>(new DummyBuildingVisualFactory()); this.buildingService = new BuildingService(); ServiceLocator.Instance.ProvideService <IBuildingService>(this.buildingService); BuildingLibrary library = this.GetFakeBuildingLibrary(); library.buildingConfigurations = new BuildingConfiguration[] { this.GetFakeBuildingConfiguration("Common_1", BuildingType.COMMON, 5, new Vector2Int(1, 1)), this.GetFakeBuildingConfiguration("Common_2", BuildingType.COMMON, -1, new Vector2Int(1, 1)), this.GetFakeBuildingConfiguration("Unique_1", BuildingType.UNIQUE, 1, new Vector2Int(2, 2)), }; this.configService.UpdateConfiguration(library); }
GameboardConfiguration CreateFakeConfig(int width, int height) { GameboardConfiguration fakeConfig = ScriptableObject.CreateInstance <GameboardConfiguration>(); fakeConfig.dimensions = new Vector2Int(width, height); return(fakeConfig); }
public void Initialise(GameboardConfiguration config) { this.Width = config.dimensions.x; this.Height = config.dimensions.y; this.grid = new bool[this.Width * this.Height]; this.Config = config; }
void InitialiseServices() { IBuildingConfigurationService buildingConfigurationService = ServiceLocator.Instance.GetService <IBuildingConfigurationService>(); BuildingLibrary library = Resources.Load <BuildingLibrary>(BuildingLibrary.RESOURCE_LOCATION); buildingConfigurationService.UpdateConfiguration(library); IGameboard gameboard = ServiceLocator.Instance.GetService <IGameboard>(); GameboardConfiguration gameboardConfig = Resources.Load <GameboardConfiguration>(GameboardConfiguration.RESOURCE_LOCATION); gameboard.Initialise(gameboardConfig); IBuildingService buildingService = ServiceLocator.Instance.GetService <IBuildingService>(); buildingService.Load(); }
public void Setup() { this.gameboardConfiguration = Resources.Load <GameboardConfiguration>(GameboardConfiguration.RESOURCE_LOCATION); }