// need to know the npcs to load, the scenery to load, the objects to load public static List <RegionContent> LoadContentForRegions(IServiceProvider serviceProvider, string rootDirectory, List <RegionNames> regions) { var regionContentList = new List <RegionContent>(); foreach (var region in regions) { var regionContent = new RegionContent(); var contentManager = new ContentManager(serviceProvider, rootDirectory); regionContent.Region = region; regionContent.NpcTextures = NpcContentLoader.LoadNpcsForRegion(contentManager, region); regionContent.ObjectTextures = LoadObjectTextures(contentManager, region); // don't need an object mapper because each object has it's own class regionContent.SceneryTextures = SceneryMapper.LoadSceneryTextures(contentManager, region); regionContent.SoundEffects = SoundMapper.LoadSoundsForRegion(contentManager, region); regionContent.ContentManager = contentManager; regionContentList.Add(regionContent); } return(regionContentList); }
private bool check_item_initialization <T>(T item, bool positionMustDiffer) where T : Item { //check data if (item.Data is null) { return(false); } //check position //if item was spawned in available position if (positionMustDiffer == false) { if (item.Position != _spawnPosition) { Assert.Fail(); } if (item.gameObject.transform.position != Utils.ToVector3(_spawnPosition)) { Assert.Fail(); } } else { if (item.Position == _spawnPosition) { Assert.Fail(); } } //check tile content if (Utils.TileAt(item.Position).Contents.Item != item) { Assert.Fail(); } //check region content RegionContent rc = Utils.NodeAt(item.Position).Subregion.Content; if (rc.Get <T>().Contains(item) == false) { Assert.Fail(); } //check stockpile manager lists if (Utils.TileAt(item.Position).Contents.StockpilePart is null) { if (StockpileManager.GetInstance().otherItems.Contains(item) == false) { Assert.Fail(); } } else { if (StockpileManager.GetInstance().stockpileItems.Contains(item) == false) { Assert.Fail(); } } return(true); }