public Shuijing PlaceCrystal(Shuijing shuijing, PATileTerrain.PABuildingTile buildingTile) { PATileTerrainChunk chunk = tileTerrain.GetChunk(buildingTile.keyTile.chunkId); shuijing.gameObject.transform.SetParent(chunk.settings.crystalGo.transform); shuijing.gameObject.transform.position = buildingTile.GetBuildingPos(tileTerrain); buildingTile.keyTile.shuijing = shuijing; shuijing.tile = buildingTile.keyTile; GameUtility.SetLayerRecursive(shuijing.transform, buildingLayer); PATileTerrain.PACrystalBuilding crystalBuildingData = new PATileTerrain.PACrystalBuilding( buildingTile.keyTile.id, shuijing.level, shuijing.elementType, shuijing.prefabName, RandomManager.NewSeed()); crystalBuildingData.shuijing = shuijing; tileTerrain.settings.AddCrystal(crystalBuildingData); return(shuijing); }
void PlaceNest(NestBuilding nest, PATileTerrain.PABuildingTile buildingTile) { Shuijing belongShuijing = buildingTile.keyTile.affectShuijing; if (belongShuijing == null) { return; } PATileTerrainChunk chunk = tileTerrain.GetChunk(buildingTile.keyTile.chunkId); nest.gameObject.transform.SetParent(chunk.settings.buildingsRoot.transform); nest.gameObject.transform.position = buildingTile.GetBuildingPos(tileTerrain); nest.tile = buildingTile.keyTile; //nest.belongShuijing = belongShuijing; GameUtility.SetLayerRecursive(nest.transform, buildingLayer); PATileTerrain.PABuilding buildingData = new PATileTerrain.PABuilding( buildingTile.keyTile.id, nest.elementType, nest.prefabName); tileTerrain.settings.GetCrystalBuilding(belongShuijing.tile.id).AddBuilding(buildingData); buildingData.belongShuijingId = belongShuijing.tile.id; belongShuijing.buildings.Add(nest.transform); }