건설 인터랙션 관련 버그 수정 및 건설 데이터 구조 개선
건설 인터랙션 시 움직이지 못하는 문제 수정 2개로 분리되어 있던 타워 데이터를 하나로 통합 - 대신 타워가 아닌 건물도 공격력 등을 정의할 수 있음
This commit is contained in:
@@ -15,38 +15,21 @@ MonoBehaviour:
|
||||
buildingName: "\uD0C0\uC6CC"
|
||||
prefab: {fileID: 8512676738329978770, guid: 3f7838db2c2fc424d9bd9a0d243b43be, type: 3}
|
||||
icon: {fileID: 0}
|
||||
width: 3
|
||||
length: 3
|
||||
height: 3
|
||||
placementOffset: {x: 0, y: 0, z: 0}
|
||||
allowRotation: 1
|
||||
requiredWorkAmount: 10
|
||||
workPerInteraction: 10
|
||||
interactionCooldown: 1
|
||||
constructionAnimationTrigger: Build
|
||||
constructionEquipment:
|
||||
socketName: RightHand
|
||||
equipmentPrefab: {fileID: 0}
|
||||
attachOnStart: 1
|
||||
detachOnEnd: 1
|
||||
keepEquipped: 0
|
||||
attachDelay: 0
|
||||
detachDelay: 0
|
||||
maxHealth: 50
|
||||
isIndestructible: 0
|
||||
autoRegenerate: 0
|
||||
regenPerSecond: 1
|
||||
providesVision: 1
|
||||
visionRange: 10
|
||||
id: 1
|
||||
memo: "\uD0C0\uC6CC"
|
||||
mana: 25
|
||||
manpower: 10
|
||||
sizeX: 3
|
||||
sizeY: 3
|
||||
sizeZ: 3
|
||||
placementOffset: {x: 0, y: 0, z: 0}
|
||||
allowRotation: 1
|
||||
manpower: 10
|
||||
maxHp: 50
|
||||
isIndestructible: 0
|
||||
autoRegenerate: 0
|
||||
regenPerSecond: 1
|
||||
atkRange: 10
|
||||
providesVision: 1
|
||||
atkDamage: 5
|
||||
atkIntervalSec: 2
|
||||
modelPath: Assets/Models/building_tower_B_blue.fbx
|
||||
|
||||
@@ -15,38 +15,21 @@ MonoBehaviour:
|
||||
buildingName: "\uBCBD"
|
||||
prefab: {fileID: 3671057791414486316, guid: ae9a9b515e1792a45887f0d967b943d6, type: 3}
|
||||
icon: {fileID: 0}
|
||||
width: 2
|
||||
length: 2
|
||||
height: 1
|
||||
placementOffset: {x: 0, y: 0, z: 0}
|
||||
allowRotation: 1
|
||||
requiredWorkAmount: 5
|
||||
workPerInteraction: 10
|
||||
interactionCooldown: 1
|
||||
constructionAnimationTrigger: Build
|
||||
constructionEquipment:
|
||||
socketName: RightHand
|
||||
equipmentPrefab: {fileID: 0}
|
||||
attachOnStart: 1
|
||||
detachOnEnd: 1
|
||||
keepEquipped: 0
|
||||
attachDelay: 0
|
||||
detachDelay: 0
|
||||
maxHealth: 30
|
||||
isIndestructible: 0
|
||||
autoRegenerate: 0
|
||||
regenPerSecond: 1
|
||||
providesVision: 1
|
||||
visionRange: 0
|
||||
id: 2
|
||||
memo: "\uBCBD"
|
||||
mana: 5
|
||||
sizeX: 4
|
||||
sizeY: 3
|
||||
sizeZ: 2
|
||||
placementOffset: {x: 0, y: 0, z: 0}
|
||||
allowRotation: 1
|
||||
manpower: 5
|
||||
sizeX: 2
|
||||
sizeY: 2
|
||||
sizeZ: 1
|
||||
maxHp: 30
|
||||
isIndestructible: 0
|
||||
autoRegenerate: 0
|
||||
regenPerSecond: 1
|
||||
atkRange: 0
|
||||
providesVision: 1
|
||||
atkDamage: 0
|
||||
atkIntervalSec: 0
|
||||
modelPath: Assets/Models/wall_straight.fbx
|
||||
|
||||
@@ -1,72 +1,83 @@
|
||||
// 이 파일은 자동 생성되었습니다. 직접 수정하지 마세요!
|
||||
// 생성 스크립트: DataTools/generate_csharp_classes.py
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic; // 리스트 지원을 위해 추가
|
||||
using Northbound;
|
||||
|
||||
namespace Northbound.Data
|
||||
{
|
||||
[CreateAssetMenu(fileName = "TowerData", menuName = "Northbound/Tower Data")]
|
||||
public class TowerData : BuildingData
|
||||
public class TowerData : ScriptableObject
|
||||
{
|
||||
[Header("기본 정보")]
|
||||
/// <summary>고유 ID</summary>
|
||||
[Header("Building Info")]
|
||||
public string buildingName;
|
||||
public GameObject prefab;
|
||||
[Tooltip("UI에 표시될 건물 아이콘")]
|
||||
public Sprite icon;
|
||||
|
||||
[Header("Basic Info")]
|
||||
[Tooltip("고유 ID")]
|
||||
public int id;
|
||||
/// <summary>기획 메모</summary>
|
||||
[Tooltip("기획 메모")]
|
||||
public string memo;
|
||||
/// <summary>건설 비용 (mana=20) (mana=50; iron=10)</summary>
|
||||
[Tooltip("건설 비용")]
|
||||
public int mana;
|
||||
/// <summary>건설 노동량</summary>
|
||||
public float manpower;
|
||||
/// <summary>X 그리드 차지 공간</summary>
|
||||
public int sizeX;
|
||||
/// <summary>Y 그리드 차지 공간</summary>
|
||||
public int sizeY;
|
||||
/// <summary>Z 차지 공간</summary>
|
||||
public int sizeZ;
|
||||
/// <summary>체력</summary>
|
||||
public int maxHp;
|
||||
/// <summary>사정거리</summary>
|
||||
public int atkRange;
|
||||
/// <summary>데미지</summary>
|
||||
public int atkDamage;
|
||||
/// <summary>공격 주기</summary>
|
||||
public float atkIntervalSec;
|
||||
/// <summary>모델 경로</summary>
|
||||
|
||||
[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;
|
||||
|
||||
private bool fieldsSynced = false;
|
||||
[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;
|
||||
|
||||
private void Awake()
|
||||
public Vector3 GetSize(int rotation)
|
||||
{
|
||||
SyncFields();
|
||||
}
|
||||
|
||||
private void SyncFields()
|
||||
{
|
||||
if (fieldsSynced) return;
|
||||
fieldsSynced = true;
|
||||
|
||||
// Map TowerData fields to BuildingData fields
|
||||
if (string.IsNullOrEmpty(base.buildingName))
|
||||
{
|
||||
base.buildingName = memo;
|
||||
}
|
||||
base.width = sizeX;
|
||||
base.length = sizeY;
|
||||
base.height = sizeZ;
|
||||
base.maxHealth = maxHp;
|
||||
base.visionRange = atkRange;
|
||||
base.requiredWorkAmount = manpower;
|
||||
base.workPerInteraction = 10f;
|
||||
base.interactionCooldown =1f;
|
||||
base.providesVision = true;
|
||||
}
|
||||
|
||||
public void EnsureSynced()
|
||||
{
|
||||
SyncFields();
|
||||
// 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