/// <summary> /// Process non-tree layer objects /// loot, nodes, supply drops, etc /// </summary> /// <param name="gameObject"></param> private void CollectGameObject(GameObjectBase gameObject) { /* Military Crates */ if (_isCollectingMilitaryCrates && gameObject.IsMilitaryCrate()) { MilitaryCrates.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Military Crates */ if (_isCollectingWoodenLootCrates && gameObject.IsNormalCrate()) { WoodenLootCrates.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Sulfur Objects */ if (_isCollectingSulfurNodes && gameObject.IsSulfurOre()) { SulfurNodes.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Metal ore entities */ if (_isCollectingMetalNodes && gameObject.IsMetalOre()) { MetalNodes.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Stone ore entities */ if (_isCollectingStoneNodes && gameObject.IsStoneOre()) { StoneNodes.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Hemp Collectables */ if (_isCollectingHempNodes && gameObject.IsHempNode()) { HempNodes.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Tool Cupboards */ if (_isCollectingToolCupboards && gameObject.IsToolCupboard()) { ToolCupboards.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Storage Containers */ if (_isCollectingStorageContainers && gameObject.IsStorageContainer()) { StorageContainers.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } }
/// <summary> /// Stop or start collecting storage containers /// </summary> public void StopOrStartCollectingStorageContainers(bool stopStart) { _isCollectingStorageContainers = stopStart; if (stopStart == false) { StorageContainers.Clear(); } }
void SetupWorld(int width, int height) { this.Width = width; this.Height = height; rooms = new List <Room> (); characters = new List <Character>(); Jobs = new JobQueue(this); storageContainers = new StorageContainers(); tiles = new Tile[width, height]; // Initialise the world array for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { // By default all tiles are empty tiles [x, y] = new Tile(x, y, TileType.Empty, this); tiles [x, y].OnBorderDefinitionChanged += OnTileBorderDefinitionChanged; tiles [x, y].OnTileAdditionChanged += OnTileAdditionChanged; } } // Every world starts with a default 10x10 room in the middle int s = 5; for (int x = -s; x <= s; x++) { for (int y = -s; y <= s; y++) { Tile t = tiles [width / 2 + x, height / 2 + y]; t.SetFloor(); if (x == s || x == -s || y == s || y == -s) { t.InstallAddition(new Wall(t), true); } } } Room startRoom = new Room(this, tiles [width / 2, height / 2]); AddRoom(startRoom); graph = new WorldGraph(rooms, this); }