크립 캠프 배치 데이터 변경
크립 캠프의 일부 기능을 MapGenerator로 이동
This commit is contained in:
@@ -11,20 +11,11 @@ namespace Northbound
|
||||
[Tooltip("Creep prefabs available to spawn")]
|
||||
[SerializeField] private List<GameObject> creepPrefabs = new List<GameObject>();
|
||||
|
||||
[Header("Spawning Settings")]
|
||||
[Tooltip("Camp strength multiplier (higher = stronger creeps)")]
|
||||
[SerializeField] private float campStrength = 1f;
|
||||
|
||||
[Tooltip("Cost budget for spawning creeps")]
|
||||
[SerializeField] private float campCostBudget = 10f;
|
||||
|
||||
[Tooltip("Spawn radius around camp")]
|
||||
[SerializeField] private float spawnRadius = 5f;
|
||||
|
||||
[Tooltip("Max creep spawn attempts")]
|
||||
[SerializeField] private int maxSpawnAttempts = 50;
|
||||
|
||||
private float _zPosition;
|
||||
private float _campStrength;
|
||||
private float _campCostBudget;
|
||||
private float _spawnRadius;
|
||||
private int _maxSpawnAttempts;
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
@@ -34,10 +25,13 @@ namespace Northbound
|
||||
}
|
||||
}
|
||||
|
||||
public void InitializeCamp(float zPosition, float strengthMultiplier)
|
||||
public void InitializeCamp(float zPosition, float strengthMultiplier, float costBudget, float radius, int maxAttempts)
|
||||
{
|
||||
_zPosition = zPosition;
|
||||
campStrength = strengthMultiplier;
|
||||
_campStrength = strengthMultiplier;
|
||||
_campCostBudget = costBudget;
|
||||
_spawnRadius = radius;
|
||||
_maxSpawnAttempts = maxAttempts;
|
||||
}
|
||||
|
||||
public void SetCreepPrefabs(List<GameObject> prefabs)
|
||||
@@ -55,16 +49,16 @@ namespace Northbound
|
||||
return;
|
||||
}
|
||||
|
||||
float remainingCost = campCostBudget * campStrength;
|
||||
float remainingCost = _campCostBudget * _campStrength;
|
||||
|
||||
int spawnedCount = 0;
|
||||
|
||||
for (int attempt = 0; attempt < maxSpawnAttempts && remainingCost > 0; attempt++)
|
||||
for (int attempt = 0; attempt < _maxSpawnAttempts && remainingCost > 0; attempt++)
|
||||
{
|
||||
GameObject selectedCreep = SelectCreepByCost(remainingCost);
|
||||
if (selectedCreep == null)
|
||||
{
|
||||
Debug.LogWarning($"[CreepCamp] Could not select creep (attempt {attempt + 1}/{maxSpawnAttempts}), remaining cost: {remainingCost:F2}");
|
||||
Debug.LogWarning($"[CreepCamp] No affordable creeps. Remaining cost: {remainingCost:F2}");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -75,21 +69,12 @@ namespace Northbound
|
||||
continue;
|
||||
}
|
||||
|
||||
if (creepData.cost > remainingCost)
|
||||
{
|
||||
if (!CanSpawnAnyCreep(remainingCost))
|
||||
{
|
||||
Debug.LogWarning($"[CreepCamp] No affordable creeps found. Remaining cost: {remainingCost:F2}");
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
SpawnCreep(selectedCreep);
|
||||
remainingCost -= creepData.cost;
|
||||
spawnedCount++;
|
||||
}
|
||||
|
||||
Debug.Log($"<color=green>[CreepCamp] Spawned {spawnedCount} creeps (Cost budget: {_campCostBudget * _campStrength:F2}, Used: {(_campCostBudget * _campStrength) - remainingCost:F2})</color>");
|
||||
}
|
||||
|
||||
private GameObject SelectCreepByCost(float remainingCost)
|
||||
@@ -172,7 +157,7 @@ namespace Northbound
|
||||
|
||||
private void SpawnCreep(GameObject prefab)
|
||||
{
|
||||
Vector3 spawnOffset = Random.insideUnitSphere * spawnRadius;
|
||||
Vector3 spawnOffset = Random.insideUnitSphere * _spawnRadius;
|
||||
spawnOffset.y = 0;
|
||||
|
||||
GameObject creep = Instantiate(prefab, transform.position + spawnOffset, Quaternion.identity);
|
||||
@@ -196,13 +181,13 @@ namespace Northbound
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawWireSphere(transform.position, spawnRadius);
|
||||
Gizmos.DrawWireSphere(transform.position, _spawnRadius);
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
Gizmos.color = new Color(1f, 0f, 0f, 0.3f);
|
||||
Gizmos.DrawSphere(transform.position, spawnRadius);
|
||||
Gizmos.DrawSphere(transform.position, _spawnRadius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Northbound
|
||||
[Tooltip("초기 자원과의 최소 거리")]
|
||||
[SerializeField] private float minDistanceFromInitialResource = 30f;
|
||||
[Tooltip("추가 크립 캠프 개수")]
|
||||
[Range(0, 10)]
|
||||
[Range(0, 1000)]
|
||||
[SerializeField] private int additionalCreepCampCount = 5;
|
||||
[Tooltip("크립 캠프 강도 기본값")]
|
||||
[SerializeField] private float baseCampStrength = 1f;
|
||||
@@ -107,6 +107,15 @@ namespace Northbound
|
||||
[Tooltip("자원 보호 캠프 강도 보너스 (far camp보다 얼마나 강할지)")]
|
||||
[SerializeField] private float resourceCampStrengthBonus = 0.5f;
|
||||
|
||||
[Tooltip("크립 스폰 비용 예산")]
|
||||
[SerializeField] private float campCostBudget = 10f;
|
||||
|
||||
[Tooltip("스폰 반경 (캠프 주변)")]
|
||||
[SerializeField] private float spawnRadius = 5f;
|
||||
|
||||
[Tooltip("최대 크립 스폰 시도 횟수")]
|
||||
[SerializeField] private int maxSpawnAttempts = 50;
|
||||
|
||||
[Header("Generation Order")]
|
||||
[Tooltip("자원 먼저 생성 후 장애물 생성 (true) 또는 그 반대 (false)")]
|
||||
[SerializeField] private bool generateResourcesFirst = true;
|
||||
@@ -845,7 +854,7 @@ namespace Northbound
|
||||
return;
|
||||
}
|
||||
|
||||
creepCamp.InitializeCamp(position.z, strength);
|
||||
creepCamp.InitializeCamp(position.z, strength, campCostBudget, spawnRadius, maxSpawnAttempts);
|
||||
creepCamp.SetCreepPrefabs(_creepPrefabs);
|
||||
Debug.Log($"[MapGenerator] Camp initialized with {_creepPrefabs.Count} creep prefabs");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user