// Lucas
        private List <SQLite_Building> LoadBuilding(int ID)
        {
            List <SQLite_Building> builings = new List <SQLite_Building>();

            List <ISQLiteRow> convert = Singletons.TableContainerSingleton.BuildingWorldEditorTable.GetMultiple(PropertyFinder <SQLiteBuildingWorldEditorModel> .Find(x => x.WorldId), ID);

            for (int i = 0; i < convert.Count; i++)
            {
                SQLite_Building builing = new SQLite_Building();

                builing.BuildingType = (EBuildingType)(convert.ElementAt(i) as SQLiteBuildingWorldEditorModel).BuildingTypeId;
                builing.Team         = (ETeam)(convert.ElementAt(i) as SQLiteBuildingWorldEditorModel).Team;
                builing.Faction      = (EFaction)(convert.ElementAt(i) as SQLiteBuildingWorldEditorModel).Faction;
                builing.X            = (convert.ElementAt(i) as SQLiteBuildingWorldEditorModel).Xpos;
                builing.Y            = (convert.ElementAt(i) as SQLiteBuildingWorldEditorModel).Ypos;

                builings.Add(builing);
            }

            return(builings);
        }
        public void SaveSQLite(TileGrid tileGrid)
        {
            List <SQLite_Ground>   grounds   = new List <SQLite_Ground>();
            List <SQLite_Building> builings  = new List <SQLite_Building>();
            List <SQLite_Unit>     units     = new List <SQLite_Unit>();
            List <SQLite_Resource> resources = new List <SQLite_Resource>();

            for (int x = 0; x < tileGrid.groundTileGrid.GetLength(0); x++)
            {
                for (int y = 0; y < tileGrid.groundTileGrid.GetLength(1); y++)
                {
                    if (tileGrid.groundTileGrid[x, y] != null)
                    {
                        SQLite_Ground ground = new SQLite_Ground();
                        ground.tileType = tileGrid.groundTileGrid[x, y].GetComponent <CTile>().TileType;
                        ground.X        = x;
                        ground.Y        = y;

                        grounds.Add(ground);
                    }
                }
            }

            for (int x = 0; x < tileGrid.buildingTileGrid.GetLength(0); x++)
            {
                for (int y = 0; y < tileGrid.buildingTileGrid.GetLength(1); y++)
                {
                    if (tileGrid.buildingTileGrid[x, y] != null)
                    {
                        SQLite_Building building = new SQLite_Building();
                        building.BuildingType = tileGrid.buildingTileGrid[x, y].GetComponent <CBuilding>().BuildingType;
                        building.Team         = tileGrid.buildingTileGrid[x, y].GetComponent <CBuilding>().Team;
                        building.Faction      = tileGrid.buildingTileGrid[x, y].GetComponent <CBuilding>().Faction;
                        building.X            = x;
                        building.Y            = y;

                        builings.Add(building);
                    }
                }
            }

            for (int x = 0; x < tileGrid.unitTileGrid.GetLength(0); x++)
            {
                for (int y = 0; y < tileGrid.unitTileGrid.GetLength(1); y++)
                {
                    if (tileGrid.unitTileGrid[x, y] != null)
                    {
                        SQLite_Unit unit = new SQLite_Unit();
                        unit.UnitType = tileGrid.unitTileGrid[x, y].GetComponent <CUnit>().UnitType;
                        unit.Team     = tileGrid.unitTileGrid[x, y].GetComponent <CUnit>().Team;
                        unit.Faction  = tileGrid.unitTileGrid[x, y].GetComponent <CUnit>().Faction;
                        unit.X        = x;
                        unit.Y        = y;

                        units.Add(unit);
                    }
                }
            }

            for (int x = 0; x < tileGrid.resourceTileGrid.GetLength(0); x++)
            {
                for (int y = 0; y < tileGrid.resourceTileGrid.GetLength(1); y++)
                {
                    if (tileGrid.resourceTileGrid[x, y] != null)
                    {
                        SQLite_Resource resource = new SQLite_Resource();
                        resource.resourcesType = tileGrid.resourceTileGrid[x, y].GetComponent <CResourceTile>().ResourcesType;
                        resource.X             = x;
                        resource.Y             = y;

                        resources.Add(resource);
                    }
                }
            }

            DoTheSQLSave(grounds, builings, units, resources);
        }