meta파일 추가 및 gitignore에서 제거
This commit is contained in:
@@ -52,11 +52,23 @@ public class ConstructionSite : MonoBehaviour
|
||||
|
||||
private void CompleteBuild()
|
||||
{
|
||||
// 1. 실제 타워 생성
|
||||
GameObject turret = Instantiate(_finalTurretPrefab, transform.position, transform.rotation);
|
||||
GameObject finalTurret = Instantiate(_finalPrefab, transform.position, Quaternion.identity);
|
||||
BuildManager.Instance.AlignToGround(finalTurret, 0f);
|
||||
|
||||
// 2. 생성된 타워의 크기를 저장해둔 사이즈로 변경!
|
||||
turret.transform.localScale = new Vector3(_size.x, 1f, _size.y);
|
||||
// [추가] 새로 생긴 터널의 노드들에게 주변 연결을 찾으라고 명령
|
||||
TunnelNode[] newNodes = finalTurret.GetComponentsInChildren<TunnelNode>();
|
||||
foreach (var node in newNodes)
|
||||
{
|
||||
node.FindNeighborNode();
|
||||
}
|
||||
|
||||
// [추가] 주변에 있던 기존 노드들도 새 노드를 찾도록 주변 검색 실행
|
||||
Collider[] neighbors = Physics.OverlapSphere(transform.position, 5f, LayerMask.GetMask("Tunnel"));
|
||||
foreach (var col in neighbors)
|
||||
{
|
||||
TunnelNode neighborNode = col.GetComponent<TunnelNode>();
|
||||
if (neighborNode != null) neighborNode.FindNeighborNode();
|
||||
}
|
||||
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user