적과 타워가 서로 공격하지 않는 문제 수정
This commit is contained in:
@@ -22,6 +22,10 @@ namespace Northbound
|
||||
private List<Building> placedBuildings = new List<Building>();
|
||||
private List<BuildingFoundation> placedFoundations = new List<BuildingFoundation>();
|
||||
|
||||
// Level 1 건물 캐시
|
||||
private List<TowerData> _buildableBuildingsCache;
|
||||
private bool _buildableCacheDirty = true;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null && Instance != this)
|
||||
@@ -41,6 +45,26 @@ namespace Northbound
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 건설 가능한 건물 목록 반환 (Level 1만, 캐싱됨)
|
||||
/// </summary>
|
||||
public List<TowerData> GetBuildableBuildings()
|
||||
{
|
||||
if (_buildableCacheDirty || _buildableBuildingsCache == null)
|
||||
{
|
||||
_buildableBuildingsCache = new List<TowerData>();
|
||||
foreach (var building in availableBuildings)
|
||||
{
|
||||
if (building != null && building.level == 1)
|
||||
{
|
||||
_buildableBuildingsCache.Add(building);
|
||||
}
|
||||
}
|
||||
_buildableCacheDirty = false;
|
||||
}
|
||||
return _buildableBuildingsCache;
|
||||
}
|
||||
|
||||
public Vector3Int WorldToGrid(Vector3 worldPosition)
|
||||
{
|
||||
return new Vector3Int(
|
||||
|
||||
Reference in New Issue
Block a user