건설 시스템 기초 생성 및 Kaykit Medival 애셋 추가
This commit is contained in:
35
Assets/Scripts/BuildingData.cs
Normal file
35
Assets/Scripts/BuildingData.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Northbound
|
||||
{
|
||||
[CreateAssetMenu(fileName = "NewBuilding", menuName = "Northbound/Building Data")]
|
||||
public class BuildingData : ScriptableObject
|
||||
{
|
||||
[Header("Building Info")]
|
||||
public string buildingName;
|
||||
public GameObject prefab;
|
||||
|
||||
[Header("Grid Size")]
|
||||
[Tooltip("Width in grid units")]
|
||||
public int width = 1;
|
||||
[Tooltip("Length in grid units")]
|
||||
public int length = 1;
|
||||
[Tooltip("Height for placement validation")]
|
||||
public float height = 2f;
|
||||
|
||||
[Header("Placement Settings")]
|
||||
[Tooltip("Offset from grid position")]
|
||||
public Vector3 placementOffset = Vector3.zero;
|
||||
[Tooltip("Can rotate this building?")]
|
||||
public bool allowRotation = true;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user