Compare commits

...

6 Commits

Author SHA1 Message Date
d28ff21213 chore: Unity meta files for weapon scripts
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 19:57:51 +09:00
5be6853a15 chore: 무기 시스템용 씬 및 프리팹 업데이트
- Player 프리팹에 WeaponEquipment 컴포넌트 추가
- 테스트 씬에서 무기 시스템 테스트 가능하도록 설정
- NetworkPrefab 목록 업데이트

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 19:56:47 +09:00
535b730f34 feat: 무기 배율 시스템 통합
- DamageEffect: 무기 데미지 배율 적용 (GetDamageMultiplier)
- PlayerSkillInput: 무기 마나 소모 배율 적용 (GetActualManaCost)
- SkillEffect: 무기 사거리 배율 적용 (가상 메서드로 구현)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 19:56:12 +09:00
df064c4eaf feat: 무기 장착 시스템 핵심 구현
- WeaponData: 무기 스탯 보너스, 배율, 슬롯, 프리팹 정보를 담은 ScriptableObject
- WeaponEquipment: 무기 장착/해제, 스탯 보너스 적용, 메시 이름 기반 소켓 검색, 스케일 보정
- WeaponSlot enum: RightHand, LeftHand, Back, Hip, TwoHanded 슬롯 지원
- GetInstanceID() 음수 버그 수정 (>= 0 → == -1 체크)
- 소켓 스케일 보정으로 0.01 스케일 메시에서도 무기가 올바른 크기로 표시됨

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 19:55:27 +09:00
2079e1b232 [UI] UI 컴포넌트 디버그 로그 제거
AbnormalityListUI, AbnormalitySlotUI, PlayerHUD, SkillSlotUI에서 불필요한 디버그 로그 제거

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 03:00:12 +09:00
2f90e8e354 [Effect] 스킬 이펙트 디버그 로그 제거
불필요한 Debug.Log 및 Debug.LogWarning 호출 제거로 프로덕션 로그 정리

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 02:59:49 +09:00
18 changed files with 901 additions and 167 deletions

View File

@@ -24,3 +24,8 @@ MonoBehaviour:
SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0}
- Override: 0
Prefab: {fileID: 100000, guid: 0cd47707143f91346868bfc349e4c4e0, type: 3}
SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0}

View File

@@ -1,5 +1,96 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &211504524078169162
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 425108118890909732}
- component: {fileID: 641669166220653710}
m_Layer: 0
m_Name: Prop_R
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &425108118890909732
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 211504524078169162}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 5, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 876336192716036432}
m_Father: {fileID: 7709863043280880487}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &641669166220653710
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 211504524078169162}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 04570063543744548b5cc95cea8bbff6, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Synty.Tools.SyntyPropBoneTool.PropBone
_wasSpawnedBySyntyTool: 1
--- !u!1 &5510832058398597268
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 876336192716036432}
- component: {fileID: 5875348249504489215}
m_Layer: 0
m_Name: Prop_R_Socket
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &876336192716036432
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5510832058398597268}
serializedVersion: 2
m_LocalRotation: {x: 0.000000048428777, y: -0.000000026077034, z: 0.70619637, w: -0.70801604}
m_LocalPosition: {x: -4.9871373, y: -4.999995, z: 0.000009025123}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 425108118890909732}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5875348249504489215
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5510832058398597268}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 04570063543744548b5cc95cea8bbff6, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Synty.Tools.SyntyPropBoneTool.PropBone
_wasSpawnedBySyntyTool: 1
--- !u!1 &6473031571298860035
GameObject:
m_ObjectHideFlags: 0
@@ -23,6 +114,7 @@ GameObject:
- component: {fileID: 1242716222252539497}
- component: {fileID: 3552488436187204500}
- component: {fileID: -5132198055668300151}
- component: {fileID: -6410357568507457303}
m_Layer: 0
m_Name: Player
m_TagString: Player
@@ -317,6 +409,7 @@ MonoBehaviour:
- {fileID: 0}
skillController: {fileID: 6912018896034183004}
networkController: {fileID: 0}
weaponEquipment: {fileID: 0}
--- !u!114 &1242716222252539497
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -369,6 +462,26 @@ MonoBehaviour:
baseValue: 100
spirit:
baseValue: 100
--- !u!114 &-6410357568507457303
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6473031571298860035}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3bebed6d2255dfc459748938470407c2, type: 3}
m_Name:
m_EditorClassIdentifier: Colosseum.Game::Colosseum.Weapons.WeaponEquipment
ShowTopMostFoldoutHeaderGroup: 1
characterStats: {fileID: -5132198055668300151}
rightHandName: Prop_R_Socket
leftHandName: Hand_L
backName: Spine
hipName: Hip
twoHandedName:
startingWeapon: {fileID: 11400000, guid: 646964ccbda84e947b97537d7f7813aa, type: 2}
--- !u!1001 &7705728874586931617
PrefabInstance:
m_ObjectHideFlags: 0
@@ -377,6 +490,10 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 4340744812167131579}
m_Modifications:
- target: {fileID: 1121787054825102, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1265346787747520, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: m_Name
value: Chr_FantasyHero_Preset_14
@@ -421,9 +538,50 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
- target: {fileID: 933129746491078306, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: m_LocalPosition.x
value: -6.583011
objectReference: {fileID: 0}
- target: {fileID: 933129746491078306, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: m_LocalPosition.y
value: -6.5999885
objectReference: {fileID: 0}
- target: {fileID: 933129746491078306, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: m_LocalPosition.z
value: 0.00000084909516
objectReference: {fileID: 0}
- target: {fileID: 4083275338838575672, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: m_LocalPosition.x
value: 6.6
objectReference: {fileID: 0}
- target: {fileID: 4083275338838575672, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: m_LocalPosition.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4083275338838575672, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6854449968133871964, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: propBoneConfig
value:
objectReference: {fileID: 11400000, guid: 711015ea15f411b4292b25e68fe06e2d, type: 2}
- target: {fileID: 6854449968133871964, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: _propBoneBindings.Array.data[0].bone
value:
objectReference: {fileID: 425108118890909732}
- target: {fileID: 6854449968133871964, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
propertyPath: _propBoneBindings.Array.data[0].socket
value:
objectReference: {fileID: 876336192716036432}
m_RemovedComponents:
- {fileID: -5600325556184611898, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
m_RemovedGameObjects:
- {fileID: 5663282852335883768, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 4169362731877062, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
insertIndex: -1
addedObject: {fileID: 425108118890909732}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
--- !u!4 &7701595578038390519 stripped
@@ -431,3 +589,8 @@ Transform:
m_CorrespondingSourceObject: {fileID: 4978357419315030, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
m_PrefabInstance: {fileID: 7705728874586931617}
m_PrefabAsset: {fileID: 0}
--- !u!4 &7709863043280880487 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4169362731877062, guid: 0b61a3665c5cd5142bf27be7c52500cf, type: 3}
m_PrefabInstance: {fileID: 7705728874586931617}
m_PrefabAsset: {fileID: 0}

View File

@@ -165,6 +165,17 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: -315}
m_SizeDelta: {x: 800, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &214410881 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6949205239376088310, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
m_PrefabInstance: {fileID: 1990079618}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4a49d1cf004a0c944be905fe6fabf936, type: 3}
m_Name:
m_EditorClassIdentifier: Colosseum.Game::Colosseum.Enemy.BossEnemy
--- !u!1 &260528172
GameObject:
m_ObjectHideFlags: 0
@@ -1679,6 +1690,77 @@ PrefabInstance:
insertIndex: -1
addedObject: {fileID: 678443229}
m_SourcePrefab: {fileID: 100100000, guid: 2122b1e1b36684a40978673f272f200e, type: 3}
--- !u!1 &1324642681
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1324642684}
- component: {fileID: 1324642683}
- component: {fileID: 1324642682}
m_Layer: 0
m_Name: BossArea
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1324642682
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1324642681}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1735054b0ca6d674b99668aeb74ba273, type: 3}
m_Name:
m_EditorClassIdentifier: Colosseum.Game::Colosseum.Enemy.BossArea
boss: {fileID: 214410881}
bossHealthBarUI: {fileID: 678443229}
hideOnExit: 0
showOnceOnly: 0
debugMode: 1
--- !u!65 &1324642683
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1324642681}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 1
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 50, y: 2, z: 50}
m_Center: {x: 0, y: 0, z: 0}
--- !u!4 &1324642684
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1324642681}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1425382920 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1229044099469274636, guid: 2122b1e1b36684a40978673f272f200e, type: 3}
@@ -2033,6 +2115,67 @@ MonoBehaviour:
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1001 &1990079618
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8365735130060185995, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: GlobalObjectIdHash
value: 860882280
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalPosition.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalPosition.z
value: 15
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5581648761285601425, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_Name
value: TestBoss
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
--- !u!1 &2122318093
GameObject:
m_ObjectHideFlags: 0
@@ -2175,67 +2318,6 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 7078605118272955058, guid: 54087b4bd46db9e4fb7da13cf7a6cc69, type: 3}
m_PrefabInstance: {fileID: 437791323}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7439438707585285505
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8365735130060185995, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: GlobalObjectIdHash
value: 3958201435
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalPosition.z
value: 10
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3122493901255878198, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5581648761285601425, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
propertyPath: m_Name
value: TestBoss
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 56986b707b0dc09439cb35ff2f87dcc9, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@@ -2247,4 +2329,5 @@ SceneRoots:
- {fileID: 1822286634}
- {fileID: 1797510781}
- {fileID: 260528176}
- {fileID: 7439438707585285505}
- {fileID: 1990079618}
- {fileID: 1324642684}

View File

@@ -1,7 +1,9 @@
using UnityEngine;
using UnityEngine.InputSystem;
using Unity.Netcode;
using Colosseum.Skills;
using Colosseum.Weapons;
namespace Colosseum.Player
{
@@ -20,6 +22,8 @@ namespace Colosseum.Player
[SerializeField] private SkillController skillController;
[Tooltip("PlayerNetworkController (없으면 자동 검색)")]
[SerializeField] private PlayerNetworkController networkController;
[Tooltip("WeaponEquipment (없으면 자동 검색)")]
[SerializeField] private WeaponEquipment weaponEquipment;
private InputSystem_Actions inputActions;
@@ -51,6 +55,12 @@ namespace Colosseum.Player
networkController = GetComponent<PlayerNetworkController>();
}
// WeaponEquipment 참조 확인
if (weaponEquipment == null)
{
weaponEquipment = GetComponent<WeaponEquipment>();
}
InitializeInputActions();
}
@@ -110,8 +120,9 @@ namespace Colosseum.Player
return;
}
// 마나 비용 체크
if (networkController != null && networkController.Mana < skill.ManaCost)
// 마나 비용 체크 (무기 배율 적용)
float actualManaCost = GetActualManaCost(skill);
if (networkController != null && networkController.Mana < actualManaCost)
{
Debug.Log($"Not enough mana for skill: {skill.SkillName}");
return;
@@ -137,13 +148,15 @@ namespace Colosseum.Player
if (skillController.IsExecutingSkill || skillController.IsOnCooldown(skill))
return;
if (networkController != null && networkController.Mana < skill.ManaCost)
// 마나 비용 체크 (무기 배율 적용)
float actualManaCost = GetActualManaCost(skill);
if (networkController != null && networkController.Mana < actualManaCost)
return;
// 마나 소모
if (networkController != null && skill.ManaCost > 0)
// 마나 소모 (무기 배율 적용)
if (networkController != null && actualManaCost > 0)
{
networkController.UseManaRpc(skill.ManaCost);
networkController.UseManaRpc(actualManaCost);
}
// 모든 클라이언트에 스킬 실행 전파
@@ -166,6 +179,19 @@ namespace Colosseum.Player
skillController.ExecuteSkill(skill);
}
/// <summary>
/// 무기 마나 배율이 적용된 실제 마나 비용 계산
/// </summary>
private float GetActualManaCost(SkillData skill)
{
if (skill == null) return 0f;
float baseCost = skill.ManaCost;
float multiplier = weaponEquipment != null ? weaponEquipment.ManaCostMultiplier : 1f;
return baseCost * multiplier;
}
/// <summary>
/// 스킬 슬롯 접근자
/// </summary>

View File

@@ -18,21 +18,12 @@ namespace Colosseum.Skills.Effects
{
if (target == null) return;
if (abnormalityData == null)
{
Debug.LogWarning($"[AbnormalityEffect] AbnormalityData is not assigned");
return;
}
if (abnormalityData == null) return;
var abnormalityManager = target.GetComponent<AbnormalityManager>();
if (abnormalityManager == null)
{
Debug.LogWarning($"[AbnormalityEffect] Target {target.name} has no AbnormalityManager");
return;
}
if (abnormalityManager == null) return;
abnormalityManager.ApplyAbnormality(abnormalityData, caster);
Debug.Log($"[AbnormalityEffect] Applied {abnormalityData.abnormalityName} to {target.name} from {caster?.name ?? "unknown"}");
}
/// <summary>

View File

@@ -2,6 +2,7 @@ using UnityEngine;
using Colosseum.Stats;
using Colosseum.Combat;
using Colosseum.Weapons;
namespace Colosseum.Skills.Effects
{
@@ -41,8 +42,6 @@ namespace Colosseum.Skills.Effects
{
damageable.TakeDamage(totalDamage, caster);
}
Debug.Log($"[Damage] {caster.name} -> {target.name}: {totalDamage:F1} ({damageType})");
}
/// <summary>
@@ -70,7 +69,24 @@ namespace Colosseum.Skills.Effects
_ => 0f,
};
return baseDamage + (statDamage * statScaling);
float baseTotal = baseDamage + (statDamage * statScaling);
// 무기 데미지 배율 적용
float damageMultiplier = GetDamageMultiplier(caster);
return baseTotal * damageMultiplier;
}
/// <summary>
/// 시전자의 무기 데미지 배율 조회
/// </summary>
private float GetDamageMultiplier(GameObject caster)
{
var weaponEquipment = caster.GetComponent<WeaponEquipment>();
if (weaponEquipment != null)
{
return weaponEquipment.DamageMultiplier;
}
return 1f;
}
}
}

View File

@@ -29,8 +29,6 @@ namespace Colosseum.Skills.Effects
{
damageable.Heal(totalHeal);
}
Debug.Log($"[Heal] {caster.name} -> {target.name}: {totalHeal:F1}");
}
/// <summary>

View File

@@ -25,8 +25,6 @@ namespace Colosseum.Skills.Effects
// TODO: 실제 물리 시스템 연동
// if (target.TryGetComponent<Rigidbody>(out var rb))
// rb.AddForce(knockback, ForceMode.Impulse);
Debug.Log($"[Knockback] {target.name}: {knockback}");
}
}
}

View File

@@ -1,5 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using Colosseum;
using Colosseum.Weapons;
namespace Colosseum.Skills
{
@@ -106,12 +108,13 @@ namespace Colosseum.Skills
{
Vector3 center = GetAreaCenter(caster);
Collider[] hits = Physics.OverlapSphere(center, Mathf.Max(areaRadius, fanRadius), targetLayers);
// 같은 GameObject가 여러 콜라이더를 가질 수 있으므로 중복 제거
HashSet<GameObject> processedTargets = new HashSet<GameObject>();
foreach (var hit in hits)
{
if (hit.gameObject == caster) continue;
if (!IsCorrectTeam(caster, hit.gameObject)) continue;
if (processedTargets.Contains(hit.gameObject)) continue;
// 부채꼴 판정
if (areaShape == AreaShapeType.Fan)
{
@@ -119,6 +122,7 @@ namespace Colosseum.Skills
continue;
}
processedTargets.Add(hit.gameObject);
ApplyEffect(caster, hit.gameObject);
}
}

View File

@@ -42,8 +42,6 @@ namespace Colosseum.UI
private void Start()
{
Debug.Log("[AbnormalityListUI] Start() called");
if (autoFindPlayer)
{
// 로컬 플레이어 찾기
@@ -52,10 +50,6 @@ namespace Colosseum.UI
// 슬롯 풀 초기화
InitializeSlotPool();
Debug.Log($"[AbnormalityListUI] slotPrefab: {(slotPrefab != null ? slotPrefab.name : "NULL")}");
Debug.Log($"[AbnormalityListUI] buffContainer: {(buffContainer != null ? buffContainer.name : "NULL")}");
Debug.Log($"[AbnormalityListUI] debuffContainer: {(debuffContainer != null ? debuffContainer.name : "NULL")}");
}
private void OnDestroy()
@@ -90,17 +84,14 @@ namespace Colosseum.UI
private void FindLocalPlayer()
{
var playerObjects = FindObjectsByType<AbnormalityManager>(FindObjectsSortMode.None);
Debug.Log($"[AbnormalityListUI] Found {playerObjects.Length} AbnormalityManager(s)");
foreach (var manager in playerObjects)
{
// 네트워크 오브젝트인 경우 로컬 플레이어 확인
if (manager.TryGetComponent<Unity.Netcode.NetworkObject>(out var netObj))
{
Debug.Log($"[AbnormalityListUI] Checking {manager.gameObject.name}, IsOwner: {netObj.IsOwner}");
if (netObj.IsOwner)
{
Debug.Log($"[AbnormalityListUI] Setting target to local player: {manager.gameObject.name}");
SetTarget(manager);
return;
}
@@ -111,13 +102,8 @@ namespace Colosseum.UI
// 첫 번째 플레이어 사용 (싱글플레이어용)
if (playerObjects.Length > 0)
{
Debug.Log($"[AbnormalityListUI] No local player found, using first manager: {playerObjects[0].gameObject.name}");
SetTarget(playerObjects[0]);
}
else
{
Debug.LogWarning("[AbnormalityListUI] No AbnormalityManager found!");
}
}
/// <summary>
@@ -126,8 +112,6 @@ namespace Colosseum.UI
/// <param name="manager">추적할 AbnormalityManager</param>
public void SetTarget(AbnormalityManager manager)
{
Debug.Log($"[AbnormalityListUI] SetTarget called with: {(manager != null ? manager.gameObject.name : "null")}");
// 기존 구독 해제
if (targetManager != null)
{
@@ -144,7 +128,6 @@ namespace Colosseum.UI
targetManager.OnAbnormalityAdded += OnAbnormalityAdded;
targetManager.OnAbnormalityRemoved += OnAbnormalityRemoved;
targetManager.OnAbnormalitiesChanged += OnAbnormalitiesChanged;
Debug.Log("[AbnormalityListUI] Events subscribed successfully");
}
// 즉시 UI 갱신
@@ -156,11 +139,7 @@ namespace Colosseum.UI
/// </summary>
private void InitializeSlotPool()
{
if (slotPrefab == null)
{
Debug.LogWarning("[AbnormalityListUI] Slot prefab is not assigned");
return;
}
if (slotPrefab == null) return;
// 필요한 만큼 슬롯 미리 생성
for (int i = 0; i < maxSlots; i++)
@@ -219,7 +198,6 @@ namespace Colosseum.UI
/// </summary>
private void OnAbnormalityAdded(ActiveAbnormality abnormality)
{
Debug.Log($"[AbnormalityListUI] OnAbnormalityAdded event received: {abnormality.Data.abnormalityName}");
ForceRefreshUI();
}
@@ -228,7 +206,6 @@ namespace Colosseum.UI
/// </summary>
private void OnAbnormalityRemoved(ActiveAbnormality abnormality)
{
Debug.Log($"[AbnormalityListUI] OnAbnormalityRemoved event received: {abnormality.Data.abnormalityName}");
ForceRefreshUI();
}
@@ -237,7 +214,6 @@ namespace Colosseum.UI
/// </summary>
private void OnAbnormalitiesChanged()
{
Debug.Log("[AbnormalityListUI] OnAbnormalitiesChanged event received");
ForceRefreshUI();
}
@@ -246,11 +222,7 @@ namespace Colosseum.UI
/// </summary>
public void ForceRefreshUI()
{
if (targetManager == null)
{
Debug.LogWarning("[AbnormalityListUI] ForceRefreshUI called but targetManager is null");
return;
}
if (targetManager == null) return;
// 모든 슬롯 반환
foreach (var slot in activeSlots.ToArray())
@@ -262,23 +234,16 @@ namespace Colosseum.UI
// 활성화된 이상 상태 표시
var abnormalities = targetManager.ActiveAbnormalities;
Debug.Log($"[AbnormalityListUI] ForceRefreshUI: {abnormalities.Count} abnormalities found");
foreach (var abnormality in abnormalities)
{
var slot = GetSlot();
if (slot == null)
{
Debug.LogWarning("[AbnormalityListUI] Could not get slot from pool");
continue;
}
if (slot == null) continue;
// 버프/디버프에 따라 적절한 컨테이너에 배치
Transform container = abnormality.Data.isDebuff ? debuffContainer : buffContainer;
if (container == null) container = transform;
Debug.Log($"[AbnormalityListUI] Adding slot for: {abnormality.Data.abnormalityName}, isDebuff: {abnormality.Data.isDebuff}, container: {container.name}");
slot.transform.SetParent(container, false);
slot.Initialize(abnormality);
slot.gameObject.SetActive(true);

View File

@@ -49,14 +49,7 @@ namespace Colosseum.UI
{
trackedAbnormality = abnormality;
if (abnormality?.Data == null)
{
Debug.LogWarning("[AbnormalitySlotUI] Initialize called with null abnormality or data");
return;
}
Debug.Log($"[AbnormalitySlotUI] Initialize: {abnormality.Data.abnormalityName}, icon: {abnormality.Data.icon?.name ?? "null"}");
Debug.Log($"[AbnormalitySlotUI] UI References - iconImage: {(iconImage != null ? "OK" : "NULL")}, durationFill: {(durationFill != null ? "OK" : "NULL")}, durationText: {(durationText != null ? "OK" : "NULL")}, backgroundImage: {(backgroundImage != null ? "OK" : "NULL")}");
if (abnormality?.Data == null) return;
// Cooltime 요소 활성화 (부모 게임오브젝트들이 비활성화되어 있을 수 있음)
EnableDurationElements();
@@ -74,11 +67,6 @@ namespace Colosseum.UI
effectNameText.text = abnormality.Data.abnormalityName;
}
else
{
Debug.LogWarning("[AbnormalitySlotUI] effectNameText is null");
}
// 배경 색상 설정 (버프/디버프 구분)
if (backgroundImage != null)
{

View File

@@ -44,11 +44,8 @@ namespace Colosseum.UI
private void FindLocalPlayer()
{
var players = FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
Debug.Log($"[PlayerHUD] Finding player... found {players.Length} players");
foreach (var player in players)
foreach (var player in FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None))
{
Debug.Log($"[PlayerHUD] Player {player.OwnerClientId}: IsOwner={player.IsOwner}, IsSpawned={player.IsSpawned}");
if (player.IsOwner)
{
SetTarget(player);
@@ -62,8 +59,6 @@ namespace Colosseum.UI
/// </summary>
public void SetTarget(PlayerNetworkController player)
{
Debug.Log($"[PlayerHUD] SetTarget called: {(player != null ? $"Player {player.OwnerClientId}" : "null")}");
// 이전 타겟 구독 해제
UnsubscribeFromEvents();
@@ -74,8 +69,6 @@ namespace Colosseum.UI
// 초기 값 설정
UpdateStatBars();
Debug.Log($"[PlayerHUD] Initial HP: {targetPlayer?.Health}/{targetPlayer?.MaxHealth}, MP: {targetPlayer?.Mana}/{targetPlayer?.MaxMana}");
}
private void SubscribeToEvents()
@@ -112,31 +105,17 @@ namespace Colosseum.UI
private void UpdateStatBars()
{
if (targetPlayer == null)
{
Debug.Log("[PlayerHUD] UpdateStatBars: targetPlayer is null");
return;
}
Debug.Log($"[PlayerHUD] UpdateStatBars: HP={targetPlayer.Health}/{targetPlayer.MaxHealth}, MP={targetPlayer.Mana}/{targetPlayer.MaxMana}");
if (targetPlayer == null) return;
if (healthBar != null)
{
healthBar.SetValue(targetPlayer.Health, targetPlayer.MaxHealth);
}
else
{
Debug.LogWarning("[PlayerHUD] healthBar is null!");
}
if (manaBar != null)
{
manaBar.SetValue(targetPlayer.Mana, targetPlayer.MaxMana);
}
else
{
Debug.LogWarning("[PlayerHUD] manaBar is null!");
}
}
}
}

View File

@@ -86,8 +86,6 @@ namespace Colosseum.UI
{
iconImage.enabled = false;
}
Debug.Log($"[SkillSlotUI] Init slot {index}: skill={skillData?.SkillName}, useIcon={useIconForCooldown}");
}
public void UpdateState(float cooldownRemaining, float cooldownTotal, bool hasEnoughMana)

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e113408f0cfce6c4aa60725c3005f25c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,107 @@
using UnityEngine;
using Colosseum.Stats;
namespace Colosseum.Weapons
{
/// <summary>
/// 무기 장착 위치
/// </summary>
public enum WeaponSlot
{
RightHand, // 오른손
LeftHand, // 왼손
Back, // 등
Hip, // 허리
TwoHanded, // 양손
}
/// <summary>
/// 무기 데이터. 무기의 기본 정보, 스탯 보너스, 배율, 외형을 관리합니다.
/// </summary>
[CreateAssetMenu(fileName = "NewWeapon", menuName = "Colosseum/Weapon")]
public class WeaponData : ScriptableObject
{
[Header("기본 정보")]
[SerializeField] private string weaponName;
[TextArea(2, 4)]
[SerializeField] private string description;
[SerializeField] private Sprite icon;
[Header("장착 설정")]
[Tooltip("무기가 장착될 슬롯")]
[SerializeField] private WeaponSlot weaponSlot = WeaponSlot.RightHand;
[Tooltip("무기 프리팹 (메시, 콜라이더 등 포함)")]
[SerializeField] private GameObject weaponPrefab;
[Tooltip("장착 시 위치 오프셋")]
[SerializeField] private Vector3 positionOffset = Vector3.zero;
[Tooltip("장착 시 회전 오프셋 (오일러 각도)")]
[SerializeField] private Vector3 rotationOffset = Vector3.zero;
[Tooltip("장착 시 스케일")]
[SerializeField] private Vector3 scale = Vector3.one;
[Header("스탯 보너스 (Flat)")]
[Tooltip("힘 보너스")]
[SerializeField] private int strengthBonus = 0;
[Tooltip("민첩 보너스")]
[SerializeField] private int dexterityBonus = 0;
[Tooltip("지능 보너스")]
[SerializeField] private int intelligenceBonus = 0;
[Tooltip("활력 보너스")]
[SerializeField] private int vitalityBonus = 0;
[Tooltip("지혜 보너스")]
[SerializeField] private int wisdomBonus = 0;
[Tooltip("정신 보너스")]
[SerializeField] private int spiritBonus = 0;
[Header("배율")]
[Tooltip("데미지 배율 (1.0 = 100%, 1.5 = 150%)")]
[Min(0f)] [SerializeField] private float damageMultiplier = 1f;
[Tooltip("사거리 배율 (1.0 = 100%, 1.2 = 120%)")]
[Min(0f)] [SerializeField] private float rangeMultiplier = 1f;
[Tooltip("마나 소모 배율 (1.0 = 100%, 0.8 = 80%)")]
[Min(0f)] [SerializeField] private float manaCostMultiplier = 1f;
// Properties - 기본 정보
public string WeaponName => weaponName;
public string Description => description;
public Sprite Icon => icon;
// Properties - 장착 설정
public WeaponSlot WeaponSlot => weaponSlot;
public GameObject WeaponPrefab => weaponPrefab;
public Vector3 PositionOffset => positionOffset;
public Vector3 RotationOffset => rotationOffset;
public Vector3 Scale => scale;
// Properties - 스탯 보너스
public int StrengthBonus => strengthBonus;
public int DexterityBonus => dexterityBonus;
public int IntelligenceBonus => intelligenceBonus;
public int VitalityBonus => vitalityBonus;
public int WisdomBonus => wisdomBonus;
public int SpiritBonus => spiritBonus;
// Properties - 배율
public float DamageMultiplier => damageMultiplier;
public float RangeMultiplier => rangeMultiplier;
public float ManaCostMultiplier => manaCostMultiplier;
/// <summary>
/// 스탯 타입에 해당하는 보너스 값 반환
/// </summary>
public int GetStatBonus(StatType statType)
{
return statType switch
{
StatType.Strength => strengthBonus,
StatType.Dexterity => dexterityBonus,
StatType.Intelligence => intelligenceBonus,
StatType.Vitality => vitalityBonus,
StatType.Wisdom => wisdomBonus,
StatType.Spirit => spiritBonus,
_ => 0,
};
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 52134ecd4c816f64888d34b2163e7af1

View File

@@ -0,0 +1,401 @@
using System;
using UnityEngine;
using Unity.Netcode;
using Colosseum.Stats;
namespace Colosseum.Weapons
{
/// <summary>
/// 무기 장착을 관리하는 컴포넌트.
/// 무기 장착 시 스탯 보너스를 적용하고 배율을 제공하며, 무기 외형을 표시합니다.
/// 메시 이름으로 소켓을 자동 검색합니다.
/// </summary>
public class WeaponEquipment : NetworkBehaviour
{
[Header("References")]
[Tooltip("CharacterStats 컴포넌트 (없으면 자동 검색)")]
[SerializeField] private CharacterStats characterStats;
[Header("Socket Names (메시 이름)")]
[Tooltip("오른손 메시 이름")]
[SerializeField] private string rightHandName = "Hand_R";
[Tooltip("왼손 메시 이름")]
[SerializeField] private string leftHandName = "Hand_L";
[Tooltip("등 메시 이름")]
[SerializeField] private string backName = "Spine";
[Tooltip("허리 메시 이름")]
[SerializeField] private string hipName = "Hip";
[Tooltip("양손 메시 이름 (기본값: 오른손 사용)")]
[SerializeField] private string twoHandedName = "";
[Header("Starting Weapon")]
[Tooltip("시작 무기 (선택)")]
[SerializeField] private WeaponData startingWeapon;
// 캐싱된 소켓 Transform들
private Transform rightHandSocket;
private Transform leftHandSocket;
private Transform backSocket;
private Transform hipSocket;
private Transform twoHandedSocket;
// 현재 장착 중인 무기
private WeaponData currentWeapon;
// 현재 생성된 무기 인스턴스
private GameObject currentWeaponInstance;
// 현재 적용된 스탯 수정자들 (해제 시 제거용)
private readonly System.Collections.Generic.Dictionary<StatType, StatModifier> activeModifiers
= new System.Collections.Generic.Dictionary<StatType, StatModifier>();
// 무기 장착 상태 동기화
private NetworkVariable<int> equippedWeaponId = new NetworkVariable<int>(-1);
public WeaponData CurrentWeapon => currentWeapon;
public bool HasWeaponEquipped => currentWeapon != null;
public GameObject CurrentWeaponInstance => currentWeaponInstance;
// 배율 프로퍼티 (무기 없으면 기본값 1.0)
public float DamageMultiplier => currentWeapon != null ? currentWeapon.DamageMultiplier : 1f;
public float RangeMultiplier => currentWeapon != null ? currentWeapon.RangeMultiplier : 1f;
public float ManaCostMultiplier => currentWeapon != null ? currentWeapon.ManaCostMultiplier : 1f;
// 이벤트
public event Action<WeaponData> OnWeaponEquipped;
public event Action<WeaponData> OnWeaponUnequipped;
private void Awake()
{
// CharacterStats 참조 확인
if (characterStats == null)
{
characterStats = GetComponent<CharacterStats>();
}
// 소켓 자동 검색
CacheSockets();
}
public override void OnNetworkSpawn()
{
// 네트워크 변수 변경 콜백
equippedWeaponId.OnValueChanged += HandleEquippedWeaponChanged;
// 서버에서 시작 무기 장착
if (IsServer && startingWeapon != null)
{
EquipWeapon(startingWeapon);
}
}
public override void OnNetworkDespawn()
{
equippedWeaponId.OnValueChanged -= HandleEquippedWeaponChanged;
}
/// <summary>
/// 메시 이름으로 소켓 Transform 캐싱
/// </summary>
private void CacheSockets()
{
rightHandSocket = FindDeepChild(rightHandName);
leftHandSocket = FindDeepChild(leftHandName);
backSocket = FindDeepChild(backName);
hipSocket = FindDeepChild(hipName);
// 양손은 별도 이름 없으면 오른손 사용
if (!string.IsNullOrEmpty(twoHandedName))
{
twoHandedSocket = FindDeepChild(twoHandedName);
}
else
{
twoHandedSocket = rightHandSocket;
}
Debug.Log($"[WeaponEquipment] Sockets cached - R:{rightHandSocket != null}, L:{leftHandSocket != null}, Back:{backSocket != null}, Hip:{hipSocket != null}");
}
/// <summary>
/// 이름으로 자식 Transform 재귀 검색
/// </summary>
private Transform FindDeepChild(string name)
{
if (string.IsNullOrEmpty(name)) return null;
// BFS로 검색
var queue = new System.Collections.Generic.Queue<Transform>();
queue.Enqueue(transform);
while (queue.Count > 0)
{
Transform current = queue.Dequeue();
if (current.name == name)
{
return current;
}
foreach (Transform child in current)
{
queue.Enqueue(child);
}
}
return null;
}
private void HandleEquippedWeaponChanged(int oldValue, int newValue)
{
// -1이면 무기 해제, 그 외에는 무기 장착됨
// (GetInstanceID()는 음수를 반환할 수 있으므로 >= 0 체크 사용 불가)
if (newValue == -1)
{
UnequipWeaponInternal();
}
// 클라이언트에서는 서버에서 이미 장착된 무기 정보를 받아야 함
// TODO: WeaponDatabase에서 ID로 WeaponData 조회
}
/// <summary>
/// 무기 장착 (서버에서만 호출)
/// </summary>
public void EquipWeapon(WeaponData weapon)
{
if (weapon == null)
{
Debug.LogWarning("[WeaponEquipment] EquipWeapon called with null weapon");
return;
}
if (!IsServer)
{
Debug.LogWarning("[WeaponEquipment] EquipWeapon can only be called on server");
return;
}
// 기존 무기 해제
if (currentWeapon != null)
{
UnequipWeapon();
}
currentWeapon = weapon;
// 스탯 보너스 적용
ApplyStatBonuses(weapon);
// 무기 외형 생성 및 부착
SpawnWeaponVisuals(weapon);
// 네트워크 동기화 (간단한 ID 사용, 실제로는 WeaponDatabase 필요)
equippedWeaponId.Value = weapon.GetInstanceID();
// 이벤트 발생
OnWeaponEquipped?.Invoke(weapon);
Debug.Log($"[WeaponEquipment] Equipped: {weapon.WeaponName} at {weapon.WeaponSlot}");
}
/// <summary>
/// 무기 해제 (서버에서만 호출)
/// </summary>
public void UnequipWeapon()
{
if (currentWeapon == null) return;
if (!IsServer)
{
Debug.LogWarning("[WeaponEquipment] UnequipWeapon can only be called on server");
return;
}
WeaponData previousWeapon = currentWeapon;
// 스탯 보너스 제거
RemoveStatBonuses();
// 무기 외형 제거
DespawnWeaponVisuals();
currentWeapon = null;
equippedWeaponId.Value = -1;
// 이벤트 발생
OnWeaponUnequipped?.Invoke(previousWeapon);
Debug.Log($"[WeaponEquipment] Unequipped: {previousWeapon.WeaponName}");
}
/// <summary>
/// 내부 해제 로직 (클라이언트 동기화용)
/// </summary>
private void UnequipWeaponInternal()
{
if (currentWeapon == null) return;
WeaponData previousWeapon = currentWeapon;
RemoveStatBonuses();
DespawnWeaponVisuals();
currentWeapon = null;
OnWeaponUnequipped?.Invoke(previousWeapon);
}
/// <summary>
/// 무기의 스탯 보너스 적용
/// </summary>
private void ApplyStatBonuses(WeaponData weapon)
{
if (characterStats == null) return;
// 모든 스탯 타입에 대해 보너스 적용
foreach (StatType statType in System.Enum.GetValues(typeof(StatType)))
{
int bonus = weapon.GetStatBonus(statType);
if (bonus != 0)
{
var stat = characterStats.GetStat(statType);
if (stat != null)
{
var modifier = new StatModifier(bonus, StatModType.Flat, weapon);
stat.AddModifier(modifier);
activeModifiers[statType] = modifier;
Debug.Log($"[WeaponEquipment] Applied {statType} +{bonus}");
}
}
}
}
/// <summary>
/// 무기의 스탯 보너스 제거
/// </summary>
private void RemoveStatBonuses()
{
if (characterStats == null) return;
// 각 스탯에서 무기로부터 추가된 수정자 제거
foreach (StatType statType in System.Enum.GetValues(typeof(StatType)))
{
var stat = characterStats.GetStat(statType);
if (stat != null && activeModifiers.TryGetValue(statType, out StatModifier modifier))
{
stat.RemoveModifier(modifier);
Debug.Log($"[WeaponEquipment] Removed {statType} modifier");
}
}
activeModifiers.Clear();
}
/// <summary>
/// 무기 외형 생성 및 부착
/// </summary>
private void SpawnWeaponVisuals(WeaponData weapon)
{
if (weapon == null || weapon.WeaponPrefab == null) return;
// 적절한 소켓 찾기
Transform socket = GetSocketForSlot(weapon.WeaponSlot);
if (socket == null)
{
Debug.LogWarning($"[WeaponEquipment] No socket found for slot: {weapon.WeaponSlot}");
return;
}
// 무기 인스턴스 생성
currentWeaponInstance = Instantiate(weapon.WeaponPrefab, socket);
currentWeaponInstance.transform.localPosition = weapon.PositionOffset;
currentWeaponInstance.transform.localRotation = Quaternion.Euler(weapon.RotationOffset);
// 소켓 스케일 보정 (부모 스케일이 작은 경우 무기도 작아지는 문제 해결)
Vector3 scaleCompensation = new Vector3(
socket.lossyScale.x != 0 ? 1f / socket.lossyScale.x : 1f,
socket.lossyScale.y != 0 ? 1f / socket.lossyScale.y : 1f,
socket.lossyScale.z != 0 ? 1f / socket.lossyScale.z : 1f
);
currentWeaponInstance.transform.localScale = Vector3.Scale(weapon.Scale, scaleCompensation);
currentWeaponInstance = Instantiate(weapon.WeaponPrefab, socket);
currentWeaponInstance.transform.localPosition = weapon.PositionOffset;
currentWeaponInstance.transform.localRotation = Quaternion.Euler(weapon.RotationOffset);
currentWeaponInstance.transform.localScale = weapon.Scale;
// 디버그: 스케일 정보 출력
Debug.Log($"[WeaponEquipment] Weapon instantiated - LocalScale: {currentWeaponInstance.transform.localScale}, LossyScale: {currentWeaponInstance.transform.lossyScale}");
Debug.Log($"[WeaponEquipment] Socket: {socket.name}, Socket scale: {socket.lossyScale}");
Debug.Log($"[WeaponEquipment] Position offset: {weapon.PositionOffset}, Rotation offset: {weapon.RotationOffset}");
// 네트워크 동기화를 위해 Spawn (서버에서만)
if (IsServer && currentWeaponInstance.TryGetComponent<NetworkObject>(out var networkObject))
{
networkObject.Spawn(true);
}
Debug.Log($"[WeaponEquipment] Spawned weapon visual: {weapon.WeaponName}");
}
/// <summary>
/// 무기 외형 제거
/// </summary>
private void DespawnWeaponVisuals()
{
if (currentWeaponInstance == null) return;
// 네트워크 Object면 Despawn
if (currentWeaponInstance.TryGetComponent<NetworkObject>(out var networkObject) && networkObject.IsSpawned)
{
if (IsServer)
{
networkObject.Despawn(true);
}
}
else
{
Destroy(currentWeaponInstance);
}
currentWeaponInstance = null;
Debug.Log("[WeaponEquipment] Despawned weapon visual");
}
/// <summary>
/// 슬롯 타입에 맞는 소켓 Transform 반환
/// </summary>
private Transform GetSocketForSlot(WeaponSlot slot)
{
return slot switch
{
WeaponSlot.RightHand => rightHandSocket,
WeaponSlot.LeftHand => leftHandSocket,
WeaponSlot.Back => backSocket,
WeaponSlot.Hip => hipSocket,
WeaponSlot.TwoHanded => twoHandedSocket != null ? twoHandedSocket : rightHandSocket,
_ => rightHandSocket,
};
}
/// <summary>
/// 서버에 무기 장착 요청
/// </summary>
[Rpc(SendTo.Server)]
public void RequestEquipWeaponRpc(int weaponInstanceId)
{
// TODO: WeaponDatabase에서 ID로 WeaponData 조회 후 EquipWeapon 호출
Debug.Log($"[WeaponEquipment] Client requested weapon equip: {weaponInstanceId}");
}
/// <summary>
/// 서버에 무기 해제 요청
/// </summary>
[Rpc(SendTo.Server)]
public void RequestUnequipWeaponRpc()
{
UnequipWeapon();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3bebed6d2255dfc459748938470407c2