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); }
public void CreateBuildings(PATileTerrain tileTerrain) { return; RandomManager.instance.SetSeed(tileTerrain.settings.GetCrystalBuilding(tile.id).randomSeed); PATileTerrainChunk chunk = tileTerrain.GetChunk(tile.chunkId); foreach (var point in vPoints) { if (point.closeTile == null) { point.closeTile = GetTileByPoint(tileTerrain, point.transform); } if (point.closeTile == null) { continue; } //Debug.Log("pointTile.x " + pointTile.x + " pointTile.y " + pointTile.y + " point " + point.transform); if (point.virtualPointType != VirtualPoint.VirtualPointType.Building) { continue; } if (!point.CheckAreaType(tileTerrain)) { if (point.building != null) { buildings.Remove(point.building); point.RemoveBuilding(); } } else { if (point.building == null) { Transform building = point.CreateBuilding(chunk.settings.decoratesRoot); if (building != null) { HatchBuilding hatchBuilding = building.GetComponent <HatchBuilding>(); if (hatchBuilding != null) { hatchBuilding.hatchId = tile.id; this.hatch = hatchBuilding; } buildings.Add(building); } } } } if (Application.isPlaying) { LocalNavMeshBuilder.instance.UpdateNavMesh(); } //foreach (var point in vPoints) //{ // if (point.virtualPointType != VirtualPoint.VirtualPointType.Animals) // continue; // if(point.building == null) // { // Transform building = point.CreateBuilding(chunk.settings.decoratesRoot); // if (building != null) // buildings.Add(building); // } //} }