private void CreateNewWaterBlock(TerrainBlock neighbourTerrainBlock) { WaterSourceBlock waterBlock = Instantiate(this); waterBlock.transform.position = new Vector3(neighbourTerrainBlock.transform.position.x, neighbourTerrainBlock.TotalHeight, neighbourTerrainBlock.transform.position.z); waterBlock.transform.SetParent(transform.parent); float height; if ((neighbourTerrainBlock.TotalHeight + currentHeight) - blockBeneath.TotalHeight > 0) { height = (blockBeneath.TotalHeight + currentHeight) - neighbourTerrainBlock.TotalHeight - flowHeightDecrease; } else { height = currentHeight - flowHeightDecrease; } waterBlock.Init(neighbourTerrainBlock.Coordinates, neighbourTerrainBlock, height, generator); children.Add(waterBlock); generator.AddToWaterGrid(waterBlock); }