액션 및 인터랙션 정의 및 기존 인터랙션 및 채광 코드 구조 개선

This commit is contained in:
2026-01-17 22:53:29 +09:00
parent 8369e4d42f
commit 9b13f439e3
22 changed files with 295 additions and 670 deletions

View File

@@ -192,7 +192,7 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
""initialStateCheck"": false
},
{
""name"": ""Attack"",
""name"": ""Action"",
""type"": ""Button"",
""id"": ""23075c94-90f6-437e-be80-4f36760bdf24"",
""expectedControlType"": """",
@@ -626,7 +626,7 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
""interactions"": """",
""processors"": """",
""groups"": "";Keyboard&Mouse"",
""action"": ""Attack"",
""action"": ""Action"",
""isComposite"": false,
""isPartOfComposite"": false
},
@@ -1291,7 +1291,7 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
m_Player_ToggleBuild = m_Player.FindAction("ToggleBuild", throwIfNotFound: true);
m_Player_Build = m_Player.FindAction("Build", throwIfNotFound: true);
m_Player_Cancel = m_Player.FindAction("Cancel", throwIfNotFound: true);
m_Player_Attack = m_Player.FindAction("Attack", throwIfNotFound: true);
m_Player_Action = m_Player.FindAction("Action", throwIfNotFound: true);
m_Player_Select1 = m_Player.FindAction("Select1", throwIfNotFound: true);
m_Player_Select2 = m_Player.FindAction("Select2", throwIfNotFound: true);
m_Player_Select3 = m_Player.FindAction("Select3", throwIfNotFound: true);
@@ -1402,7 +1402,7 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
private readonly InputAction m_Player_ToggleBuild;
private readonly InputAction m_Player_Build;
private readonly InputAction m_Player_Cancel;
private readonly InputAction m_Player_Attack;
private readonly InputAction m_Player_Action;
private readonly InputAction m_Player_Select1;
private readonly InputAction m_Player_Select2;
private readonly InputAction m_Player_Select3;
@@ -1465,9 +1465,9 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
/// </summary>
public InputAction @Cancel => m_Wrapper.m_Player_Cancel;
/// <summary>
/// Provides access to the underlying input action "Player/Attack".
/// Provides access to the underlying input action "Player/Action".
/// </summary>
public InputAction @Attack => m_Wrapper.m_Player_Attack;
public InputAction @Action => m_Wrapper.m_Player_Action;
/// <summary>
/// Provides access to the underlying input action "Player/Select1".
/// </summary>
@@ -1551,9 +1551,9 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
@Cancel.started += instance.OnCancel;
@Cancel.performed += instance.OnCancel;
@Cancel.canceled += instance.OnCancel;
@Attack.started += instance.OnAttack;
@Attack.performed += instance.OnAttack;
@Attack.canceled += instance.OnAttack;
@Action.started += instance.OnAction;
@Action.performed += instance.OnAction;
@Action.canceled += instance.OnAction;
@Select1.started += instance.OnSelect1;
@Select1.performed += instance.OnSelect1;
@Select1.canceled += instance.OnSelect1;
@@ -1616,9 +1616,9 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
@Cancel.started -= instance.OnCancel;
@Cancel.performed -= instance.OnCancel;
@Cancel.canceled -= instance.OnCancel;
@Attack.started -= instance.OnAttack;
@Attack.performed -= instance.OnAttack;
@Attack.canceled -= instance.OnAttack;
@Action.started -= instance.OnAction;
@Action.performed -= instance.OnAction;
@Action.canceled -= instance.OnAction;
@Select1.started -= instance.OnSelect1;
@Select1.performed -= instance.OnSelect1;
@Select1.canceled -= instance.OnSelect1;
@@ -2015,12 +2015,12 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnCancel(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Attack" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// Method invoked when associated input action "Action" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnAttack(InputAction.CallbackContext context);
void OnAction(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Select1" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>

View File

@@ -106,7 +106,7 @@
"initialStateCheck": false
},
{
"name": "Attack",
"name": "Action",
"type": "Button",
"id": "23075c94-90f6-437e-be80-4f36760bdf24",
"expectedControlType": "",
@@ -540,7 +540,7 @@
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Attack",
"action": "Action",
"isComposite": false,
"isPartOfComposite": false
},

View File

@@ -108,7 +108,8 @@ AnimatorState:
m_Name: Locomotion
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_Transitions:
- {fileID: 5781145710961441674}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@@ -149,31 +150,6 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 0
--- !u!1101 &954603756796225056
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Attack
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1042583441410514574}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &1042583441410514574
AnimatorState:
serializedVersion: 6
@@ -276,6 +252,31 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &5781145710961441674
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Attack
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1042583441410514574}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.82954544
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &7110953658697184367
AnimatorStateTransition:
m_ObjectHideFlags: 1
@@ -318,14 +319,13 @@ AnimatorStateMachine:
m_Position: {x: 340, y: 80, z: 0}
- serializedVersion: 1
m_State: {fileID: 1042583441410514574}
m_Position: {x: 340, y: -60, z: 0}
m_Position: {x: 650, y: -120, z: 0}
- serializedVersion: 1
m_State: {fileID: 7354546966716114735}
m_Position: {x: 340, y: -200, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions:
- {fileID: 7110953658697184367}
- {fileID: 954603756796225056}
- {fileID: 404349288434198591}
m_EntryTransitions: []
m_StateMachineTransitions: {}

View File

@@ -0,0 +1,18 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 16b4dd78bd34c8e4885c9b160e4c25a2, type: 3}
m_Name: MiningActionData
m_EditorClassIdentifier: Assembly-CSharp::MiningActionData
actionName: Mining
duration: 1
animTrigger: Attack
damage: 50

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 677adf45880ed9e4a80b2f113fff07f8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -222,6 +222,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: ffaf1ddb2ff58d2448ccfdd357387f63, type: 3}
insertIndex: -1
addedObject: {fileID: 5271692149337681293}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: ffaf1ddb2ff58d2448ccfdd357387f63, type: 3}
insertIndex: -1
addedObject: {fileID: 8444973872686006962}
m_SourcePrefab: {fileID: 100100000, guid: ffaf1ddb2ff58d2448ccfdd357387f63, type: 3}
--- !u!4 &2152733048352974824 stripped
Transform:
@@ -343,6 +346,10 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 256
buildSpeedMultiplier: 2
pickupRadius: 1.5
itemLayer:
serializedVersion: 2
m_Bits: 16384
attackRange: 5
aimRadius: 0.5
miningDamage: 25
@@ -356,6 +363,8 @@ MonoBehaviour:
crosshairUI: {fileID: 0}
idleCrosshair: {fileID: 2628378444897590106, guid: 174f7cb20aaa6d4409b788a700a925ad, type: 3}
targetCrosshair: {fileID: -5662625722731528258, guid: 7652364ca249c3144813de7eb3d1b129, type: 3}
visionRadius: 5
miningAction: {fileID: 11400000, guid: 677adf45880ed9e4a80b2f113fff07f8, type: 2}
--- !u!114 &106528027568436521
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -451,6 +460,19 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PlayerInventory
ShowTopMostFoldoutHeaderGroup: 1
--- !u!114 &8444973872686006962
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2473992278589500093}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59175e0893d83ae4198b22adcdbd6de5, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PlayerActionHandler
ShowTopMostFoldoutHeaderGroup: 1
--- !u!4 &5371267496600762819 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7214371169738337839, guid: ffaf1ddb2ff58d2448ccfdd357387f63, type: 3}

View File

@@ -674,7 +674,7 @@ MonoBehaviour:
m_OverrideTileSize: 0
m_TileSize: 256
m_OverrideVoxelSize: 0
m_VoxelSize: 0.016666668
m_VoxelSize: 0.16666667
m_MinRegionArea: 2
m_NavMeshData: {fileID: 23800000, guid: 2d822e23a760f3943a3174a0d27b4254, type: 2}
m_BuildHeightMesh: 0
@@ -2159,230 +2159,6 @@ Transform:
m_Children: []
m_Father: {fileID: 1842105546}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1312361473
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1312361477}
- component: {fileID: 1312361476}
- component: {fileID: 1312361475}
- component: {fileID: 1312361474}
m_Layer: 0
m_Name: Cube (4)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1312361474
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1312361473}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1312361475
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1312361473}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: -876546973899608171, guid: 3f6cafd8e6c7439468e51113a73ddc7b, type: 3}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1312361476
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1312361473}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1312361477
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1312361473}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.4486299, y: 2.47453, z: -1}
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!1 &1318420719
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1318420723}
- component: {fileID: 1318420722}
- component: {fileID: 1318420721}
- component: {fileID: 1318420720}
m_Layer: 0
m_Name: Cube (2)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1318420720
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1318420719}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1318420721
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1318420719}
m_Enabled: 1
m_CastShadows: 2
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: -876546973899608171, guid: 3f6cafd8e6c7439468e51113a73ddc7b, type: 3}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1318420722
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1318420719}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1318420723
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1318420719}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.4486299, y: 2.47453, z: -1}
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!1001 &1320111437
PrefabInstance:
m_ObjectHideFlags: 0
@@ -2794,118 +2570,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &1414232855
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1414232859}
- component: {fileID: 1414232858}
- component: {fileID: 1414232857}
- component: {fileID: 1414232856}
m_Layer: 0
m_Name: Cube (3)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1414232856
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1414232855}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1414232857
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1414232855}
m_Enabled: 1
m_CastShadows: 2
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: -876546973899608171, guid: 3f6cafd8e6c7439468e51113a73ddc7b, type: 3}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1414232858
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1414232855}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1414232859
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1414232855}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.4486299, y: 4.47453, z: -1}
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!1001 &1489230404
PrefabInstance:
m_ObjectHideFlags: 0
@@ -2983,118 +2647,6 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 17532917e1ada23469c573abf64905f0, type: 3}
--- !u!1 &1508528265
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1508528269}
- component: {fileID: 1508528268}
- component: {fileID: 1508528267}
- component: {fileID: 1508528266}
m_Layer: 0
m_Name: Cube (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1508528266
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1508528265}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1508528267
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1508528265}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: -876546973899608171, guid: a2407126e3372f64cacb75ed466a5621, type: 3}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1508528268
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1508528265}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1508528269
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1508528265}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.24752, y: 1.3870399, z: -1}
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!1 &1558135260
GameObject:
m_ObjectHideFlags: 0
@@ -4013,118 +3565,6 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2072761343
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2072761347}
- component: {fileID: 2072761346}
- component: {fileID: 2072761345}
- component: {fileID: 2072761344}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &2072761344
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2072761343}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &2072761345
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2072761343}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: -876546973899608171, guid: a2407126e3372f64cacb75ed466a5621, type: 3}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &2072761346
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2072761343}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &2072761347
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2072761343}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.53123, y: 0.78704, z: -1}
m_LocalScale: {x: 3, y: 1, z: 3}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &2084947170 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2338240775821095493, guid: 1955bdf7dd2940f44aa117fbcf6eb626, type: 3}
@@ -4256,9 +3696,4 @@ SceneRoots:
- {fileID: 1489230404}
- {fileID: 556982644}
- {fileID: 2067098344}
- {fileID: 2072761347}
- {fileID: 1384281111}
- {fileID: 1508528269}
- {fileID: 1318420723}
- {fileID: 1414232859}
- {fileID: 1312361477}

View File

@@ -2,6 +2,5 @@ using UnityEngine;
public interface IInteractable
{
// 누가 상호작용을 시도했는지 알려주기 위해 GameObject를 인자로 받습니다.
void Interact(GameObject user);
void Interact(GameObject interactor);
}

View File

@@ -0,0 +1,13 @@
[System.Serializable]
public class ActionDescriptor
{
public float duration = 0.5f;
public string animTrigger = "Interact";
// 필요하다면 여기에 사운드 이펙트나 파티클 정보를 추가할 수 있습니다.
}
// 명세를 제공하는 인터페이스
public interface IActionProvider
{
ActionDescriptor GetActionDescriptor();
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 142278604af401248b9afd92554cfb0c

View File

@@ -0,0 +1,17 @@
using UnityEngine;
[CreateAssetMenu(menuName = "Actions/Mining")]
public class MiningActionData : PlayerActionData
{
public int damage = 50;
public override void ExecuteEffect(GameObject performer, GameObject target)
{
if (target.TryGetComponent<MineableBlock>(out var block))
{
// 서버 RPC 호출은 블록 내부의 로직을 그대로 사용합니다.
block.TakeDamageRpc(damage);
block.PlayHitEffectClientRpc();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 16b4dd78bd34c8e4885c9b160e4c25a2

View File

@@ -0,0 +1,11 @@
using UnityEngine;
public abstract class PlayerActionData : ScriptableObject
{
public string actionName;
public float duration; // 액션 자체가 시간을 가짐
public string animTrigger;
// 대상(target)은 있을 수도 있고(채광), 없을 수도 있음(회복/대쉬)
public abstract void ExecuteEffect(GameObject performer, GameObject target);
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 510ffea359d2cc448924f064aa29ace8

View File

@@ -0,0 +1,54 @@
using Unity.Netcode;
using UnityEngine;
using System.Collections;
public class PlayerActionHandler : NetworkBehaviour
{
private bool _isBusy;
public bool IsBusy => _isBusy;
private Animator _animator;
void Awake() => _animator = GetComponent<Animator>();
// [통로 1] 인터랙션 실행 (대상 중심)
public void PerformInteraction(IInteractable target)
{
if (_isBusy || target == null) return;
// 대상으로부터 정보를 가져옴
var provider = (target as MonoBehaviour).GetComponent<IActionProvider>();
ActionDescriptor desc = provider?.GetActionDescriptor();
StartCoroutine(InteractionRoutine(desc, target));
}
// [통로 2] 액션 실행 (행동 중심)
public void PerformAction(PlayerActionData actionData, GameObject target = null)
{
if (_isBusy || actionData == null) return;
StartCoroutine(ActionRoutine(actionData, target));
}
private IEnumerator InteractionRoutine(ActionDescriptor desc, IInteractable target)
{
_isBusy = true;
if (desc != null) _animator.SetTrigger(desc.animTrigger);
target.Interact(gameObject); // 로직 실행
yield return new WaitForSeconds(desc?.duration ?? 0.1f);
_isBusy = false;
}
private IEnumerator ActionRoutine(PlayerActionData data, GameObject target)
{
_isBusy = true;
_animator.SetTrigger(data.animTrigger);
data.ExecuteEffect(gameObject, target); // 로직 실행
yield return new WaitForSeconds(data.duration);
_isBusy = false;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 59175e0893d83ae4198b22adcdbd6de5

View File

@@ -31,7 +31,6 @@ public class PlayerMovement : MonoBehaviour
_inputActions = new PlayerInputActions();
_inputActions.Player.Jump.performed += ctx => OnJump();
_inputActions.Player.Attack.performed += ctx => OnAttack();
_inputActions.Player.Interact.performed += ctx => OnInteract();
}
@@ -104,12 +103,6 @@ public class PlayerMovement : MonoBehaviour
if (_isGrounded) _velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
}
private void OnAttack()
{
if (_traveler != null && _traveler.IsTraveling) return;
_animator.SetTrigger("Attack");
}
private void OnInteract()
{
// 터널 이동 중에는 상호작용 금지

View File

@@ -1,8 +1,9 @@
using UnityEngine;
using UnityEngine.InputSystem;
using Unity.Netcode;
using Unity.Netcode.Components;
using System;
using Unity.Cinemachine;
using System.Collections;
[RequireComponent(typeof(NetworkObject))]
public class PlayerNetworkController : NetworkBehaviour
@@ -39,6 +40,10 @@ public class PlayerNetworkController : NetworkBehaviour
[SerializeField] private float visionRadius = 5f; // 시야 반경
private float _lastRevealTime;
[Header("Action System")]
[SerializeField] private PlayerActionData miningAction; // 채광에 대한 시간/애니메이션/효과 데이터
private PlayerActionHandler _actionHandler; // 새 핸들러 연결[Header("Action Data")]
private RectTransform _crosshairRect;
private MineableBlock _currentTargetBlock; // 현재 강조 중인 블록 저장
private MineableBlock _lastHighlightedBlock;
@@ -54,6 +59,12 @@ public class PlayerNetworkController : NetworkBehaviour
private bool _isGrounded;
private bool _isHoldingInteract = false;
// 현재 플레이어가 어떤 행동을 하고 있는지 나타내는 상태
public enum ActionState { Idle, Busy }
private ActionState _currentState = ActionState.Idle;
public bool IsBusy => _currentState == ActionState.Busy;
// 디버그 변수
private Vector3 _debugOrigin;
private Vector3 _debugDir;
@@ -89,7 +100,7 @@ public class PlayerNetworkController : NetworkBehaviour
_inputActions = new PlayerInputActions();
_inputActions.Player.Jump.performed += ctx => OnJump();
_inputActions.Player.Attack.performed += ctx => OnAttackInput();
_inputActions.Player.Action.performed += ctx => OnActionInput();
_inputActions.Player.Interact.performed += ctx => OnInteractTap(); // 탭 상호작용
_inputActions.Player.Interact.started += ctx => _isHoldingInteract = true;
@@ -103,6 +114,7 @@ public class PlayerNetworkController : NetworkBehaviour
_controller = GetComponent<CharacterController>();
_animator = GetComponent<Animator>();
_traveler = GetComponent<TunnelTraveler>();
_actionHandler = GetComponent<PlayerActionHandler>();
}
void Update()
@@ -163,20 +175,26 @@ public class PlayerNetworkController : NetworkBehaviour
if (_isGrounded) _velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
}
private void OnAttackInput()
// 1. 액션 (좌클릭) - 대상이 없어도 나감
private void OnActionInput()
{
if (!IsOwner) return;
if (!IsOwner || _actionHandler.IsBusy) return;
// 현재 하이라이트 중인 블록이 있그 녀석이 바로 공격 대상입니다!
if (_lastHighlightedBlock != null)
// 조준 중인 블록이 있넘기고, 없으면 null을 넘겨서 실행
GameObject target = _lastHighlightedBlock?.gameObject;
_actionHandler.PerformAction(miningAction, target);
}
// 2. 인터랙션 (F키) - 대상이 없으면 아예 시작 안 함
private void OnInteractTap()
{
if (!IsOwner || _actionHandler.IsBusy) return;
IInteractable target = GetClosestInteractable();
if (target != null)
{
if (_lastHighlightedBlock.TryGetComponent<NetworkObject>(out var netObj))
{
ApplyMiningDamageServerRpc(netObj.NetworkObjectId);
}
_actionHandler.PerformInteraction(target);
}
_animator.SetTrigger("Attack");
}
[Rpc(SendTo.Server)]
@@ -199,38 +217,6 @@ public class PlayerNetworkController : NetworkBehaviour
[ClientRpc]
private void OnAttackClientRpc() => _animator.SetTrigger("Attack");
private void OnInteractTap()
{
if (!IsOwner) return;
_animator.SetTrigger("Interact");
// 1. 캐릭터 주변 반경 내의 모든 콜라이더 감지
Collider[] colliders = Physics.OverlapSphere(transform.position, interactRange, interactableLayer);
IInteractable closestTarget = null;
float minDistance = float.MaxValue;
foreach (var col in colliders)
{
// 2. 방향 조건 없이 거리만 체크하여 가장 가까운 것 선택
float dist = Vector3.Distance(transform.position, col.transform.position);
if (dist < minDistance)
{
IInteractable interactable = col.GetComponentInParent<IInteractable>();
if (interactable != null)
{
minDistance = dist;
closestTarget = interactable;
}
}
}
// 3. 가장 가까운 대상이 있다면 상호작용 실행
if (closestTarget != null)
{
closestTarget.Interact(gameObject);
}
}
// 건설 지원 로직 (범위 내 지속 작업이므로 OverlapSphere 유지 또는 Raycast로 변경 가능)
private void PerformConstructionSupport()
@@ -402,6 +388,54 @@ public class PlayerNetworkController : NetworkBehaviour
}
}
private IEnumerator ActionRoutine(float duration, string animTrigger, Action actionLogic)
{
// 1. 상태 잠금
_currentState = ActionState.Busy;
// 2. 애니메이션 실행
if (!string.IsNullOrEmpty(animTrigger))
{
_animator.SetTrigger(animTrigger);
}
// 3. 실제 로직 실행 (상호작용, 아이템 사용 등)
actionLogic?.Invoke();
// 4. 지정된 시간만큼 대기
yield return new WaitForSeconds(duration);
// 5. 상태 해제
_currentState = ActionState.Idle;
}
private IInteractable GetClosestInteractable()
{
// 1. 지정된 레이어 내의 콜라이더 탐색
Collider[] colliders = Physics.OverlapSphere(transform.position, interactRange, interactableLayer);
IInteractable closest = null;
float minDistance = float.MaxValue;
foreach (var col in colliders)
{
// 2. IInteractable 인터페이스를 가지고 있는지 확인 (부모 포함)
IInteractable interactable = col.GetComponentInParent<IInteractable>();
if (interactable != null)
{
float dist = Vector3.Distance(transform.position, col.transform.position);
if (dist < minDistance)
{
minDistance = dist;
closest = interactable;
}
}
}
return closest;
}
private void OnDrawGizmos()
{
if (!Application.isPlaying || !IsOwner) return;