Базовая генерация пропов
This commit is contained in:
1 parent
db0eed28af
commit
ffda350c58
51 files changed
+2755
-27
No files matched your search
@@ -21,7 +21,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
Debug.LogWarning($"{view.name}: для комнаты не назначена тема");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ApplyMaterial(view.FloorRenderers, theme.floorMaterial);
|
||||
ApplyMaterial(view.WallRenderers, theme.wallMaterial);
|
||||
ApplyMaterial(view.CeilingRenderers, theme.ceilingMaterial);
|
||||
@@ -153,7 +153,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
? BodyClass.Trooper // На старте всегда даём сбалансированного Штурмовика (или Скаута)
|
||||
: PickClass(rt, config);
|
||||
|
||||
Vector3 spawnPos = FindSpawnPosition(minX, maxX, minZ, maxZ, view.CenterMeters, rt == RoomType.Start, spawnedPositions);
|
||||
Vector3 spawnPos = FindSpawnPosition(view, minX, maxX, minZ, maxZ, view.CenterMeters, rt == RoomType.Start, spawnedPositions);
|
||||
spawnedPositions.Add(spawnPos);
|
||||
|
||||
GameObject prefab = ResolveEnemyPrefab(chosenClass, config);
|
||||
@@ -165,7 +165,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
|
||||
// Подбирает точку спавна в комнате так, чтобы враги не слипались друг с другом
|
||||
// и не спавнились прямо на голове игрока в Start-комнате
|
||||
private static Vector3 FindSpawnPosition(float minX, float maxX, float minZ, float maxZ,
|
||||
private static Vector3 FindSpawnPosition(RoomView view, float minX, float maxX, float minZ, float maxZ,
|
||||
Vector3 roomCenter, bool isStartRoom, List<Vector3> occupied)
|
||||
{
|
||||
for (int attempt = 0; attempt < 15; attempt++)
|
||||
@@ -178,6 +178,13 @@ namespace _Project.Scripts.LevelGenerating
|
||||
// В стартовой комнате игрок падает в центр, поэтому врага ставим чуть поодаль от центра
|
||||
if (isStartRoom && Vector2.Distance(new Vector2(candidate.x, candidate.z), new Vector2(roomCenter.x, roomCenter.z)) < 2.5f)
|
||||
continue;
|
||||
bool onProp = false;
|
||||
foreach (var r in view.PropFootprints)
|
||||
{
|
||||
var expanded = new Rect(r.x - 0.6f, r.y - 0.6f, r.width + 1.2f, r.height + 1.2f);
|
||||
if (expanded.Contains(new Vector2(candidate.x, candidate.z))) { onProp = true; break; }
|
||||
}
|
||||
if (onProp) continue;
|
||||
|
||||
bool tooClose = false;
|
||||
foreach (var pos in occupied)
|
||||
|
||||
Reference in new issue
Block a user