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

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

View File

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

View File

@@ -108,7 +108,8 @@ AnimatorState:
m_Name: Locomotion m_Name: Locomotion
m_Speed: 1 m_Speed: 1
m_CycleOffset: 0 m_CycleOffset: 0
m_Transitions: [] m_Transitions:
- {fileID: 5781145710961441674}
m_StateMachineBehaviours: [] m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0} m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0 m_IKOnFeet: 0
@@ -149,31 +150,6 @@ AnimatorStateTransition:
m_InterruptionSource: 0 m_InterruptionSource: 0
m_OrderedInterruption: 1 m_OrderedInterruption: 1
m_CanTransitionToSelf: 0 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 --- !u!1102 &1042583441410514574
AnimatorState: AnimatorState:
serializedVersion: 6 serializedVersion: 6
@@ -276,6 +252,31 @@ AnimatorStateTransition:
m_InterruptionSource: 0 m_InterruptionSource: 0
m_OrderedInterruption: 1 m_OrderedInterruption: 1
m_CanTransitionToSelf: 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 --- !u!1101 &7110953658697184367
AnimatorStateTransition: AnimatorStateTransition:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@@ -318,14 +319,13 @@ AnimatorStateMachine:
m_Position: {x: 340, y: 80, z: 0} m_Position: {x: 340, y: 80, z: 0}
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 1042583441410514574} m_State: {fileID: 1042583441410514574}
m_Position: {x: 340, y: -60, z: 0} m_Position: {x: 650, y: -120, z: 0}
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 7354546966716114735} m_State: {fileID: 7354546966716114735}
m_Position: {x: 340, y: -200, z: 0} m_Position: {x: 340, y: -200, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: m_AnyStateTransitions:
- {fileID: 7110953658697184367} - {fileID: 7110953658697184367}
- {fileID: 954603756796225056}
- {fileID: 404349288434198591} - {fileID: 404349288434198591}
m_EntryTransitions: [] m_EntryTransitions: []
m_StateMachineTransitions: {} 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} - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: ffaf1ddb2ff58d2448ccfdd357387f63, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 5271692149337681293} addedObject: {fileID: 5271692149337681293}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: ffaf1ddb2ff58d2448ccfdd357387f63, type: 3}
insertIndex: -1
addedObject: {fileID: 8444973872686006962}
m_SourcePrefab: {fileID: 100100000, guid: ffaf1ddb2ff58d2448ccfdd357387f63, type: 3} m_SourcePrefab: {fileID: 100100000, guid: ffaf1ddb2ff58d2448ccfdd357387f63, type: 3}
--- !u!4 &2152733048352974824 stripped --- !u!4 &2152733048352974824 stripped
Transform: Transform:
@@ -343,6 +346,10 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
m_Bits: 256 m_Bits: 256
buildSpeedMultiplier: 2 buildSpeedMultiplier: 2
pickupRadius: 1.5
itemLayer:
serializedVersion: 2
m_Bits: 16384
attackRange: 5 attackRange: 5
aimRadius: 0.5 aimRadius: 0.5
miningDamage: 25 miningDamage: 25
@@ -356,6 +363,8 @@ MonoBehaviour:
crosshairUI: {fileID: 0} crosshairUI: {fileID: 0}
idleCrosshair: {fileID: 2628378444897590106, guid: 174f7cb20aaa6d4409b788a700a925ad, type: 3} idleCrosshair: {fileID: 2628378444897590106, guid: 174f7cb20aaa6d4409b788a700a925ad, type: 3}
targetCrosshair: {fileID: -5662625722731528258, guid: 7652364ca249c3144813de7eb3d1b129, type: 3} targetCrosshair: {fileID: -5662625722731528258, guid: 7652364ca249c3144813de7eb3d1b129, type: 3}
visionRadius: 5
miningAction: {fileID: 11400000, guid: 677adf45880ed9e4a80b2f113fff07f8, type: 2}
--- !u!114 &106528027568436521 --- !u!114 &106528027568436521
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -451,6 +460,19 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PlayerInventory m_EditorClassIdentifier: Assembly-CSharp::PlayerInventory
ShowTopMostFoldoutHeaderGroup: 1 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 --- !u!4 &5371267496600762819 stripped
Transform: Transform:
m_CorrespondingSourceObject: {fileID: 7214371169738337839, guid: ffaf1ddb2ff58d2448ccfdd357387f63, type: 3} m_CorrespondingSourceObject: {fileID: 7214371169738337839, guid: ffaf1ddb2ff58d2448ccfdd357387f63, type: 3}

View File

@@ -674,7 +674,7 @@ MonoBehaviour:
m_OverrideTileSize: 0 m_OverrideTileSize: 0
m_TileSize: 256 m_TileSize: 256
m_OverrideVoxelSize: 0 m_OverrideVoxelSize: 0
m_VoxelSize: 0.016666668 m_VoxelSize: 0.16666667
m_MinRegionArea: 2 m_MinRegionArea: 2
m_NavMeshData: {fileID: 23800000, guid: 2d822e23a760f3943a3174a0d27b4254, type: 2} m_NavMeshData: {fileID: 23800000, guid: 2d822e23a760f3943a3174a0d27b4254, type: 2}
m_BuildHeightMesh: 0 m_BuildHeightMesh: 0
@@ -2159,230 +2159,6 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 1842105546} m_Father: {fileID: 1842105546}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 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 --- !u!1001 &1320111437
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2794,118 +2570,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {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 --- !u!1001 &1489230404
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2983,118 +2647,6 @@ PrefabInstance:
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 17532917e1ada23469c573abf64905f0, type: 3} 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 --- !u!1 &1558135260
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -4013,118 +3565,6 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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 --- !u!4 &2084947170 stripped
Transform: Transform:
m_CorrespondingSourceObject: {fileID: 2338240775821095493, guid: 1955bdf7dd2940f44aa117fbcf6eb626, type: 3} m_CorrespondingSourceObject: {fileID: 2338240775821095493, guid: 1955bdf7dd2940f44aa117fbcf6eb626, type: 3}
@@ -4256,9 +3696,4 @@ SceneRoots:
- {fileID: 1489230404} - {fileID: 1489230404}
- {fileID: 556982644} - {fileID: 556982644}
- {fileID: 2067098344} - {fileID: 2067098344}
- {fileID: 2072761347}
- {fileID: 1384281111} - {fileID: 1384281111}
- {fileID: 1508528269}
- {fileID: 1318420723}
- {fileID: 1414232859}
- {fileID: 1312361477}

View File

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

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

View File

@@ -1,8 +1,9 @@
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
using Unity.Netcode; using Unity.Netcode;
using Unity.Netcode.Components; using System;
using Unity.Cinemachine; using Unity.Cinemachine;
using System.Collections;
[RequireComponent(typeof(NetworkObject))] [RequireComponent(typeof(NetworkObject))]
public class PlayerNetworkController : NetworkBehaviour public class PlayerNetworkController : NetworkBehaviour
@@ -39,6 +40,10 @@ public class PlayerNetworkController : NetworkBehaviour
[SerializeField] private float visionRadius = 5f; // 시야 반경 [SerializeField] private float visionRadius = 5f; // 시야 반경
private float _lastRevealTime; private float _lastRevealTime;
[Header("Action System")]
[SerializeField] private PlayerActionData miningAction; // 채광에 대한 시간/애니메이션/효과 데이터
private PlayerActionHandler _actionHandler; // 새 핸들러 연결[Header("Action Data")]
private RectTransform _crosshairRect; private RectTransform _crosshairRect;
private MineableBlock _currentTargetBlock; // 현재 강조 중인 블록 저장 private MineableBlock _currentTargetBlock; // 현재 강조 중인 블록 저장
private MineableBlock _lastHighlightedBlock; private MineableBlock _lastHighlightedBlock;
@@ -54,6 +59,12 @@ public class PlayerNetworkController : NetworkBehaviour
private bool _isGrounded; private bool _isGrounded;
private bool _isHoldingInteract = false; 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 _debugOrigin;
private Vector3 _debugDir; private Vector3 _debugDir;
@@ -89,7 +100,7 @@ public class PlayerNetworkController : NetworkBehaviour
_inputActions = new PlayerInputActions(); _inputActions = new PlayerInputActions();
_inputActions.Player.Jump.performed += ctx => OnJump(); _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.performed += ctx => OnInteractTap(); // 탭 상호작용
_inputActions.Player.Interact.started += ctx => _isHoldingInteract = true; _inputActions.Player.Interact.started += ctx => _isHoldingInteract = true;
@@ -103,6 +114,7 @@ public class PlayerNetworkController : NetworkBehaviour
_controller = GetComponent<CharacterController>(); _controller = GetComponent<CharacterController>();
_animator = GetComponent<Animator>(); _animator = GetComponent<Animator>();
_traveler = GetComponent<TunnelTraveler>(); _traveler = GetComponent<TunnelTraveler>();
_actionHandler = GetComponent<PlayerActionHandler>();
} }
void Update() void Update()
@@ -163,20 +175,26 @@ public class PlayerNetworkController : NetworkBehaviour
if (_isGrounded) _velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity); if (_isGrounded) _velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
} }
private void OnAttackInput() // 1. 액션 (좌클릭) - 대상이 없어도 나감
private void OnActionInput()
{ {
if (!IsOwner) return; if (!IsOwner || _actionHandler.IsBusy) return;
// 현재 하이라이트 중인 블록이 있그 녀석이 바로 공격 대상입니다! // 조준 중인 블록이 있넘기고, 없으면 null을 넘겨서 실행
if (_lastHighlightedBlock != 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)) _actionHandler.PerformInteraction(target);
{
ApplyMiningDamageServerRpc(netObj.NetworkObjectId);
}
} }
_animator.SetTrigger("Attack");
} }
[Rpc(SendTo.Server)] [Rpc(SendTo.Server)]
@@ -199,38 +217,6 @@ public class PlayerNetworkController : NetworkBehaviour
[ClientRpc] [ClientRpc]
private void OnAttackClientRpc() => _animator.SetTrigger("Attack"); 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로 변경 가능) // 건설 지원 로직 (범위 내 지속 작업이므로 OverlapSphere 유지 또는 Raycast로 변경 가능)
private void PerformConstructionSupport() 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() private void OnDrawGizmos()
{ {
if (!Application.isPlaying || !IsOwner) return; if (!Application.isPlaying || !IsOwner) return;

View File

@@ -3,10 +3,11 @@
--- !u!55 &1 --- !u!55 &1
PhysicsManager: PhysicsManager:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 13 serializedVersion: 22
m_Gravity: {x: 0, y: -9.81, z: 0} m_Gravity: {x: 0, y: -9.81, z: 0}
m_DefaultMaterial: {fileID: 0} m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2 m_BounceThreshold: 2
m_DefaultMaxDepenetrationVelocity: 10
m_SleepThreshold: 0.005 m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01 m_DefaultContactOffset: 0.01
m_DefaultSolverIterations: 6 m_DefaultSolverIterations: 6
@@ -16,11 +17,11 @@ PhysicsManager:
m_EnableAdaptiveForce: 0 m_EnableAdaptiveForce: 0
m_ClothInterCollisionDistance: 0.1 m_ClothInterCollisionDistance: 0.1
m_ClothInterCollisionStiffness: 0.2 m_ClothInterCollisionStiffness: 0.2
m_ContactsGeneration: 1 m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffffffffffffffffffffffffffffffffffffffbdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff m_SimulationMode: 0
m_AutoSimulation: 1
m_AutoSyncTransforms: 0 m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1 m_ReuseCollisionCallbacks: 1
m_InvokeCollisionCallbacks: 1
m_ClothInterCollisionSettingsToggle: 0 m_ClothInterCollisionSettingsToggle: 0
m_ClothGravity: {x: 0, y: -9.81, z: 0} m_ClothGravity: {x: 0, y: -9.81, z: 0}
m_ContactPairsMode: 0 m_ContactPairsMode: 0
@@ -31,6 +32,13 @@ PhysicsManager:
m_WorldSubdivisions: 8 m_WorldSubdivisions: 8
m_FrictionType: 0 m_FrictionType: 0
m_EnableEnhancedDeterminism: 0 m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1 m_ImprovedPatchFriction: 0
m_GenerateOnTriggerStayEvents: 1
m_SolverType: 0 m_SolverType: 0
m_DefaultMaxAngularSpeed: 50 m_DefaultMaxAngularSpeed: 50
m_ScratchBufferChunkCount: 4
m_CurrentBackendId: 4072204805
m_FastMotionThreshold: 3.4028235e+38
m_SceneBuffersReleaseInterval: 0
m_ReleaseSceneBuffers: 0
m_LogVerbosity: 3

View File

@@ -8,6 +8,10 @@ EditorBuildSettings:
- enabled: 1 - enabled: 1
path: Assets/Scenes/SampleScene.unity path: Assets/Scenes/SampleScene.unity
guid: 99c9720ab356a0642a771bea13969a05 guid: 99c9720ab356a0642a771bea13969a05
- enabled: 1
path: Assets/Scenes/DefenceScene.unity
guid: c46860faadd6f944b98633b1e6c3c6de
m_configObjects: m_configObjects:
com.unity.dt.app-ui: {fileID: 11400000, guid: 1b1c20d82303e4b5781c3ef50ac1449f, type: 2}
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3} com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
m_UseUCBPForAssetBundles: 0 m_UseUCBPForAssetBundles: 0

View File

@@ -58,7 +58,7 @@ GraphicsSettings:
m_FogKeepExp2: 1 m_FogKeepExp2: 1
m_AlbedoSwatchInfos: [] m_AlbedoSwatchInfos: []
m_RenderPipelineGlobalSettingsMap: m_RenderPipelineGlobalSettingsMap:
UnityEngine.Rendering.Universal.UniversalRenderPipeline: {fileID: 11400000, guid: 18dc0cd2c080841dea60987a38ce93fa, type: 2} UnityEngine.Rendering.Universal.UniversalRenderPipeline: {fileID: 11400000, guid: 93b439a37f63240aca3dd4e01d978a9f, type: 2}
m_ShaderBuildSettings: m_ShaderBuildSettings:
keywordDeclarationOverrides: [] keywordDeclarationOverrides: []
m_LightsUseLinearIntensity: 1 m_LightsUseLinearIntensity: 1

View File

@@ -825,7 +825,8 @@ PlayerSettings:
webGLCloseOnQuit: 0 webGLCloseOnQuit: 0
webWasm2023: 0 webWasm2023: 0
webEnableSubmoduleStrippingCompatibility: 0 webEnableSubmoduleStrippingCompatibility: 0
scriptingDefineSymbols: {} scriptingDefineSymbols:
Standalone: APP_UI_EDITOR_ONLY
additionalCompilerArguments: {} additionalCompilerArguments: {}
platformArchitecture: {} platformArchitecture: {}
scriptingBackend: scriptingBackend: