From 9d47c7e5fcdad9fa0a865927999c84e3e533f89e Mon Sep 17 00:00:00 2001 From: qoralstmd6825 Date: Fri, 13 Feb 2026 16:05:31 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=ED=94=BD=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/extensions.json | 5 + .vscode/launch.json | 10 + .vscode/settings.json | 71 +++++ Assets/Resources/Prefabs/Player/Ghost.prefab | 4 +- Assets/Resources/Prefabs/Player/Player.prefab | 4 +- .../Resources/Scenes/LevelScene/Level_1.unity | 50 +++- .../Resources/Scripts/Manager/SpawnManager.cs | 78 +++-- Backup/ReplayPuzzleGame.slnx | 4 + ProjectSettings/Physics2DSettings.asset | 2 +- ReplayPuzzleGame.slnx | 4 + UpgradeLog.htm | 276 ++++++++++++++++++ 11 files changed, 481 insertions(+), 27 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 Backup/ReplayPuzzleGame.slnx create mode 100644 ReplayPuzzleGame.slnx create mode 100644 UpgradeLog.htm diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..ddb6ff8 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "visualstudiotoolsforunity.vstuc" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..da60e25 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,10 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Attach to Unity", + "type": "vstuc", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6c8a372 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,71 @@ +{ + "files.exclude": { + "**/.DS_Store": true, + "**/.git": true, + "**/.vs": true, + "**/.gitmodules": true, + "**/.vsconfig": true, + "**/*.booproj": true, + "**/*.pidb": true, + "**/*.suo": true, + "**/*.user": true, + "**/*.userprefs": true, + "**/*.unityproj": true, + "**/*.dll": true, + "**/*.exe": true, + "**/*.pdf": true, + "**/*.mid": true, + "**/*.midi": true, + "**/*.wav": true, + "**/*.gif": true, + "**/*.ico": true, + "**/*.jpg": true, + "**/*.jpeg": true, + "**/*.png": true, + "**/*.psd": true, + "**/*.tga": true, + "**/*.tif": true, + "**/*.tiff": true, + "**/*.3ds": true, + "**/*.3DS": true, + "**/*.fbx": true, + "**/*.FBX": true, + "**/*.lxo": true, + "**/*.LXO": true, + "**/*.ma": true, + "**/*.MA": true, + "**/*.obj": true, + "**/*.OBJ": true, + "**/*.asset": true, + "**/*.cubemap": true, + "**/*.flare": true, + "**/*.mat": true, + "**/*.meta": true, + "**/*.prefab": true, + "**/*.unity": true, + "build/": true, + "Build/": true, + "Library/": true, + "library/": true, + "obj/": true, + "Obj/": true, + "Logs/": true, + "logs/": true, + "ProjectSettings/": true, + "UserSettings/": true, + "temp/": true, + "Temp/": true + }, + "files.associations": { + "*.asset": "yaml", + "*.meta": "yaml", + "*.prefab": "yaml", + "*.unity": "yaml", + }, + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.patterns": { + "*.sln": "*.csproj", + "*.slnx": "*.csproj" + }, + "dotnet.defaultSolution": "ReplayPuzzleGame.slnx" +} \ No newline at end of file diff --git a/Assets/Resources/Prefabs/Player/Ghost.prefab b/Assets/Resources/Prefabs/Player/Ghost.prefab index 1a4e6cb..3d92955 100644 --- a/Assets/Resources/Prefabs/Player/Ghost.prefab +++ b/Assets/Resources/Prefabs/Player/Ghost.prefab @@ -185,7 +185,7 @@ MonoBehaviour: moveSpeed: 4 jumpForce: 8.5 poleForce: 3 - groundCheckSize: {x: 1.2, y: 0.2} + groundCheckSize: {x: 0.95, y: 0.2} groundCheckOffset: {x: 0, y: -0.5} hangCheckSize: {x: 1.2, y: 0.97} hangCheckOffset: {x: 0, y: -0.2} @@ -250,7 +250,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &4340425662678190451 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Prefabs/Player/Player.prefab b/Assets/Resources/Prefabs/Player/Player.prefab index 9fc1e45..576c3e6 100644 --- a/Assets/Resources/Prefabs/Player/Player.prefab +++ b/Assets/Resources/Prefabs/Player/Player.prefab @@ -141,7 +141,7 @@ MonoBehaviour: moveSpeed: 4 jumpForce: 8.5 poleForce: 3 - groundCheckSize: {x: 1.2, y: 0.2} + groundCheckSize: {x: 1.18, y: 0.2} groundCheckOffset: {x: 0, y: -0.5} hangCheckSize: {x: 1.2, y: 0.81} hangCheckOffset: {x: 0, y: -0.2} @@ -294,7 +294,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &8793401598569977826 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Scenes/LevelScene/Level_1.unity b/Assets/Resources/Scenes/LevelScene/Level_1.unity index bc8ee7e..1db1b46 100644 --- a/Assets/Resources/Scenes/LevelScene/Level_1.unity +++ b/Assets/Resources/Scenes/LevelScene/Level_1.unity @@ -5173,6 +5173,54 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 605171125080917740, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 605171125080917740, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 605171125080917740, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 605171125080917740, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1320285034244313337, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1320285034244313337, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1320285034244313337, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1320285034244313337, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5424197064635361057, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5424197064635361057, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5424197064635361057, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5424197064635361057, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6452561418906399231, guid: 021b91bfee59ac546b2a0d5ca2b87683, type: 3} propertyPath: m_Name value: UIManager @@ -5421,7 +5469,7 @@ Transform: m_GameObject: {fileID: 1105961119} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -13.2, y: 0.58, z: 0} + m_LocalPosition: {x: -13.2, y: 2.36, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: diff --git a/Assets/Resources/Scripts/Manager/SpawnManager.cs b/Assets/Resources/Scripts/Manager/SpawnManager.cs index 7834fbe..116664d 100644 --- a/Assets/Resources/Scripts/Manager/SpawnManager.cs +++ b/Assets/Resources/Scripts/Manager/SpawnManager.cs @@ -7,21 +7,15 @@ using UnityEngine.SceneManagement; public class SpawnManager : MonoBehaviour { public static SpawnManager instance; - - // 프리팹 설정 + [SerializeField] private GameObject playerPrefab; [SerializeField] private GameObject ghostPrefab; - - // 스폰 위치 설정 [SerializeField] private Transform spawnPoint; - - // 플레이어 입력받은거 리스트 + private List> allRecordedFrames; - // 현재 있는 고스트 리스트 private List activeGhostList; - // 리플레이 횟수 private int currentReplayIndex; - + private InputRecorder currentPlayerRecorder; private GameObject currentPlayer; @@ -43,12 +37,11 @@ public class SpawnManager : MonoBehaviour private void FixedUpdate() { - // 맵에 존재하는 고스트가 존재하지 않으면 Return if (activeGhostList.Count == 0) { return; } - + for (int i = 0; i < activeGhostList.Count; i++) { ActiveGhost ghost = activeGhostList[i]; @@ -68,39 +61,82 @@ public class SpawnManager : MonoBehaviour { if (spawnPoint == null) { - Debug.LogError("spawnPoint 설정하기"); + Debug.LogError("spawnPoint is null"); + return; } + currentPlayer = Instantiate(playerPrefab, spawnPoint.position, Quaternion.identity); + + AlignToGround(currentPlayer); + currentPlayerRecorder = currentPlayer.GetComponent(); currentPlayerRecorder.StartRecording(); } + private void AlignToGround(GameObject player) + { + Rigidbody2D _rigidbody = player.GetComponent(); + if (_rigidbody != null) + { + _rigidbody.linearVelocity = Vector2.zero; + _rigidbody.angularVelocity = 0f; + } + + Physics2D.SyncTransforms(); + + BoxCollider2D col = player.GetComponent(); + float halfHeight = 0f; + + if (col != null) + { + halfHeight = (col.size.y * player.transform.localScale.y) * 0.5f; + halfHeight -= col.offset.y; + } + + RaycastHit2D hit = Physics2D.Raycast(player.transform.position, Vector2.down, 10f, LayerMask.GetMask("Ground")); + + if (hit.collider != null) + { + Vector3 finalPos = new Vector3(hit.point.x, hit.point.y + halfHeight, player.transform.position.z); + player.transform.position = finalPos; + } + } + public void StopRecordingAndReStart() { currentPlayerRecorder.StopRecording(); List inputFrames = currentPlayerRecorder.GetInputFrames(); allRecordedFrames.Add(inputFrames); - Destroy(currentPlayer); + foreach (var ghost in activeGhostList) { Destroy(ghost.controller.gameObject); } activeGhostList.Clear(); - SpawnPlayer(); + + currentPlayer.GetComponent().StartRecording(); + CameraEffect cameraEffect = FindFirstObjectByType(); - cameraEffect.SetTarget(currentPlayer.transform); + if (cameraEffect != null) + { + cameraEffect.SetTarget(currentPlayer.transform); + } + currentReplayIndex = 0; SoundManager.instance.PlaySFX(SfxType.Replay); - for(int i = 0; i < 1; i++) + + for (int i = 0; i < 1; i++) { foreach (var record in allRecordedFrames) { GameObject ghost = Instantiate(ghostPrefab, spawnPoint.position, Quaternion.identity); GhostController ghostController = ghost.GetComponent(); - ActiveGhost addedGhost = new ActiveGhost(); - addedGhost.controller = ghostController; - addedGhost.recordedFrames = record; - + ActiveGhost addedGhost = new ActiveGhost + { + controller = ghostController, + recordedFrames = record + }; + activeGhostList.Add(addedGhost); } } @@ -112,4 +148,4 @@ public class ActiveGhost { public GhostController controller; public List recordedFrames; -} +} \ No newline at end of file diff --git a/Backup/ReplayPuzzleGame.slnx b/Backup/ReplayPuzzleGame.slnx new file mode 100644 index 0000000..d629b17 --- /dev/null +++ b/Backup/ReplayPuzzleGame.slnx @@ -0,0 +1,4 @@ + + + + diff --git a/ProjectSettings/Physics2DSettings.asset b/ProjectSettings/Physics2DSettings.asset index 213bde4..978c1e2 100644 --- a/ProjectSettings/Physics2DSettings.asset +++ b/ProjectSettings/Physics2DSettings.asset @@ -53,5 +53,5 @@ Physics2DSettings: m_ReuseCollisionCallbacks: 1 m_AutoSyncTransforms: 0 m_GizmoOptions: 10 - m_LayerCollisionMatrix: fffefffffffefffffffefffffffffffffffefffffffeffff7ffdffff3ffdffffc8feffff3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + m_LayerCollisionMatrix: 000000000000000000000000c0000000c0000000000000001801000018010000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 m_PhysicsLowLevelSettings: {fileID: 0} diff --git a/ReplayPuzzleGame.slnx b/ReplayPuzzleGame.slnx new file mode 100644 index 0000000..2e7157f --- /dev/null +++ b/ReplayPuzzleGame.slnx @@ -0,0 +1,4 @@ + + + + diff --git a/UpgradeLog.htm b/UpgradeLog.htm new file mode 100644 index 0000000..8e90c00 --- /dev/null +++ b/UpgradeLog.htm @@ -0,0 +1,276 @@ + + + + 마이그레이션 보고서 +

+ 마이그레이션 보고서 -

\ No newline at end of file