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

55 lines
2.4 KiB
C#
Raw 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 UnityEngine;
namespace _Project.Scripts.LevelGenerating
{
public enum PropPlacement
{
AlongWall, // вплотную к стене, передом в комнату
Corner, // в углу
Center, // острова: не ближе нескольких клеток к стенам
Anywhere // где угодно
}
[Serializable]
public class PropEntry
{
public string name;
public GameObject prefab;
public PropPlacement placement = PropPlacement.AlongWall;
[Tooltip("Сколько штук на комнату (случайно от min до max)")]
public int minCount = 1;
public int maxCount = 1;
[Tooltip("Не ставить в комнатах меньше этой площади, м2")]
public float minRoomArea = 0f;
[Tooltip("Если перед модели смотрит не в +Z, поверни: например 180, если перед в -Z")]
public float frontYawOffset = 0f;
[Tooltip("Отступ от стены в клетках (1 клетка = 0.5 м)")]
public int wallGap = 0;
[Tooltip("Свободное место вокруг в клетках, чтобы предметы не слипались")]
public int padding = 1;
[Tooltip("Для Center и Anywhere: случайный поворот на 90 градусов")]
public bool randomYaw = true;
}
// =====================================================================
// Набор предметов для комнаты. Создаётся: ПКМ -> Create -> Level -> Room Prop Set.
// Назначается в RoomTheme (поле Props). Новый предмет - это новая строка в списке.
// =====================================================================
[CreateAssetMenu(menuName = "Level/Room Prop Set", fileName = "RoomPropSet")]
public class RoomPropSet : ScriptableObject
{
[Tooltip("Сколько метров перед дверью держать свободными")]
public float doorClearance = 1.5f;
[Tooltip("Порядок важен: предметы ставятся сверху вниз, крупные пиши первыми")]
public List<PropEntry> props = new List<PropEntry>();
}
}