Souljack/Assets/_Project/Scripts/LevelGenerating/RoomEnemySpawnConfig.cs

46 lines
2.4 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using _Project.Scripts.PlayerUtils;
using UnityEngine;
namespace _Project.Scripts.LevelGenerating
{
[Serializable]
public class EnemySpawnEntry
{
public BodyClass enemyClass = BodyClass.Trooper;
[Tooltip("Кастомный префаб этого класса. Если пусто — возьмётся общий префаб или создастся капсула.")]
public GameObject customPrefab;
[Tooltip("Вес (шанс) выбора этого класса относительно других в списке")]
[Min(1f)] public float weight = 10f;
}
// =====================================================================
// Конфиг спавна врагов для темы комнаты (RoomTheme).
// Создаётся: ПКМ -> Create -> Level -> Room Enemy Spawn Config.
// =====================================================================
[CreateAssetMenu(menuName = "Level/Room Enemy Spawn Config", fileName = "RoomEnemySpawnConfig")]
public class RoomEnemySpawnConfig : ScriptableObject
{
[Header("Количество врагов в комнате")]
[Min(0)] public int minEnemies = 2;
[Min(0)] public int maxEnemies = 4;
[Tooltip("Добавлять +1 врага за каждые N кв. метров площади (0 = не зависит от размера комнаты)")]
[Min(0f)] public float extraEnemyPerArea = 35f;
[Tooltip("Отступ от стен при спавне врагов (в метрах)")]
[Min(1f)] public float wallMargin = 2f;
[Header("Префаб по умолчанию")]
[Tooltip("Если не назначен — генератор сам соберёт работающую капсулу с EnemyAI!")]
public GameObject defaultEnemyPrefab;
[Header("Пул классов для этой комнаты")]
public List<EnemySpawnEntry> enemyPool = new List<EnemySpawnEntry>
{
new EnemySpawnEntry { enemyClass = BodyClass.Scout, weight = 25f },
new EnemySpawnEntry { enemyClass = BodyClass.Trooper, weight = 45f },
new EnemySpawnEntry { enemyClass = BodyClass.Juggernaut, weight = 15f },
new EnemySpawnEntry { enemyClass = BodyClass.Sniper, weight = 15f }
};
}
}