Files
Northbound/Assets/Data/Scripts/DataClasses/TowerData.cs
dal4segno 4200288fae 건설 인터랙션 관련 버그 수정 및 건설 데이터 구조 개선
건설 인터랙션 시 움직이지 못하는 문제 수정
2개로 분리되어 있던 타워 데이터를 하나로 통합
 - 대신 타워가 아닌 건물도 공격력 등을 정의할 수 있음
2026-02-01 16:09:57 +09:00

84 lines
2.7 KiB
C#

using UnityEngine;
namespace Northbound.Data
{
[CreateAssetMenu(fileName = "TowerData", menuName = "Northbound/Tower Data")]
public class TowerData : ScriptableObject
{
[Header("Building Info")]
public string buildingName;
public GameObject prefab;
[Tooltip("UI에 표시될 건물 아이콘")]
public Sprite icon;
[Header("Basic Info")]
[Tooltip("고유 ID")]
public int id;
[Tooltip("기획 메모")]
public string memo;
[Tooltip("건설 비용")]
public int mana;
[Header("Grid Size")]
[Tooltip("X 그리드 차지 공간")]
public int sizeX = 1;
[Tooltip("Y 그리드 차지 공간")]
public int sizeY = 1;
[Tooltip("Z 차지 공간")]
public int sizeZ = 2;
[Header("Placement Settings")]
[Tooltip("Offset from grid position")]
public Vector3 placementOffset = Vector3.zero;
[Tooltip("Can rotate this building?")]
public bool allowRotation = true;
[Header("Construction Settings")]
[Tooltip("건설 완료에 필요한 총 작업량")]
public float manpower = 100f;
[Header("Health Settings")]
[Tooltip("체력")]
public int maxHp = 100;
[Tooltip("Can this building be damaged?")]
public bool isIndestructible = false;
[Tooltip("Auto-regenerate health over time")]
public bool autoRegenerate = false;
[Tooltip("Health regeneration per second")]
public int regenPerSecond = 1;
[Header("Vision Settings")]
[Tooltip("사정거리")]
public int atkRange = 15;
[Tooltip("Does this building provide vision?")]
public bool providesVision = true;
[Header("Attack Settings")]
[Tooltip("데미지")]
public int atkDamage = 10;
[Tooltip("공격 주기")]
public float atkIntervalSec = 1f;
[Header("Model Settings")]
[Tooltip("모델 경로")]
public string modelPath;
[Header("Properties for convenience")]
public int width => sizeX;
public int length => sizeY;
public float height => sizeZ;
public int maxHealth => maxHp;
public float visionRange => atkRange;
public float requiredWorkAmount => manpower;
public Vector3 GetSize(int rotation)
{
// Rotation 0,180 = normal, 90,270 = swap width/length
bool isRotated = (rotation == 1 || rotation == 3);
float w = isRotated ? length : width;
float l = isRotated ? width : length;
return new Vector3(w, height, l);
}
}
}