//Clear snapped from cache and clean up any dictionaries public IEnumerator RemoveSnapper(BuildingSnapper snapper) { buildingSnappers[snapper.buildingType][snapper.transform.position].Remove(snapper); Vector3 pos = snapper.transform.position; BuildingTypes type = snapper.buildingType; //No more supports exist at this snapper's position - if a building component exists there, destroy it if (buildingSnappers[type][pos].Count == 0) { if (type != BuildingTypes.foundation) { if (structures[type].ContainsKey(pos)) { NewBuildingComponent component = structures[type][pos]; yield return(new WaitForSeconds(delayDominoTime)); if (component) { Destroy(component.gameObject); } } } buildingSnappers[type].Remove(pos); } else //Activate the most recently instantiated snapper at this position { EnableLastSnapperAtPos(type, pos); } }
//Clear snapped from cache and clean up any dictionaries public void RemoveBuildingComponent(NewBuildingComponent component) { structures[component.buildingType].Remove(component.transform.position); }
//Add building component public void AddBuildingComponent(NewBuildingComponent component) { structures[component.buildingType].Add(component.transform.position, component); }