2026-06-19 UI, UI로직

This commit is contained in:
skrwns304@gmail.com
2026-06-19 14:27:40 +09:00
parent b751a9ed66
commit b1e85a5b89
549 changed files with 18058 additions and 20 deletions

View File

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

View File

@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: e0e619da4f226dc40975bb5a9772e3fb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: ade04a3aaded49041a1b3ab9690dc8b8
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,142 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4559783618867527029
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
version: 10
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: M_LeftFootprint
m_Shader: {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- MOTIONVECTORS
- DepthOnly
- SHADOWCASTER
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: e0e619da4f226dc40975bb5a9772e3fb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: e0e619da4f226dc40975bb5a9772e3fb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BlendOp: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _DstBlendAlpha: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _SampleGI: 0
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _WorkflowMode: 1
- _XRMotionVectorsPass: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ccd6efa6e31f417478e74c59dbf0970c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,142 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4559783618867527029
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
version: 10
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: M_RightFootprint
m_Shader: {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- MOTIONVECTORS
- DepthOnly
- SHADOWCASTER
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: ade04a3aaded49041a1b3ab9690dc8b8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: ade04a3aaded49041a1b3ab9690dc8b8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BlendOp: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _DstBlendAlpha: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _SampleGI: 0
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _WorkflowMode: 1
- _XRMotionVectorsPass: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4aaca72663e664f4285a7590ece80457
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

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

Binary file not shown.

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 28c37a34c57ef5748b85d3cda74c3a61
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c75c9f5d97c6f144ab9edbca7df9f09f
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,173 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FootprintHintManager : MonoBehaviour
{
[Header("VR Player Reference")]
[Tooltip("XR Origin의 Main Camera Transform을 넣는 것을 추천합니다.")]
[SerializeField] private Transform playerTarget;
[Header("Footprint Prefabs")]
[SerializeField] private GameObject leftFootPrefab;
[SerializeField] private GameObject rightFootPrefab;
[Header("Footprint Settings")]
[SerializeField] private int footprintCount = 6;
[SerializeField] private float spacing = 0.45f;
[SerializeField] private float sideOffset = 0.13f;
[SerializeField] private float showTime = 2f;
[SerializeField] private bool startWithLeftFoot = true;
[Header("Ground Settings")]
[SerializeField] private bool useGroundRaycast = true;
[SerializeField] private LayerMask groundMask = ~0;
[SerializeField] private float raycastHeight = 2f;
[SerializeField] private float raycastDistance = 5f;
[SerializeField] private float groundOffset = 0.03f;
[SerializeField] private float fallbackGroundY = 0f;
private readonly List<GameObject> spawnedFootprints = new List<GameObject>();
private Coroutine footprintRoutine;
public void ShowFootprints(MazeDirection direction)
{
if (footprintRoutine != null)
StopCoroutine(footprintRoutine);
footprintRoutine = StartCoroutine(ShowFootprintRoutine(direction));
}
private IEnumerator ShowFootprintRoutine(MazeDirection direction)
{
ClearFootprints();
if (playerTarget == null)
{
Debug.LogWarning("FootprintHintManager: Player Target is missing.");
footprintRoutine = null;
yield break;
}
if (leftFootPrefab == null || rightFootPrefab == null)
{
Debug.LogWarning("FootprintHintManager: Left Foot Prefab or Right Foot Prefab is missing.");
footprintRoutine = null;
yield break;
}
Vector3 moveDirection = GetWorldDirection(direction);
if (moveDirection == Vector3.zero)
{
footprintRoutine = null;
yield break;
}
Vector3 sideDirection = Vector3.Cross(Vector3.up, moveDirection).normalized;
for (int i = 0; i < footprintCount; i++)
{
bool isLeftFoot = startWithLeftFoot ? i % 2 == 0 : i % 2 != 0;
GameObject prefabToUse = isLeftFoot ? leftFootPrefab : rightFootPrefab;
float forwardDistance = spacing * (i + 1);
float leftRightOffset = isLeftFoot ? -sideOffset : sideOffset;
Vector3 spawnPosition =
playerTarget.position +
moveDirection * forwardDistance +
sideDirection * leftRightOffset;
Quaternion spawnRotation = Quaternion.LookRotation(moveDirection, Vector3.up);
PlaceOnGround(ref spawnPosition, ref spawnRotation, moveDirection);
GameObject footprint = Instantiate(
prefabToUse,
spawnPosition,
spawnRotation
);
spawnedFootprints.Add(footprint);
}
yield return new WaitForSeconds(showTime);
ClearFootprints();
footprintRoutine = null;
}
private Vector3 GetWorldDirection(MazeDirection direction)
{
Vector3 forward = playerTarget.forward;
Vector3 right = playerTarget.right;
forward.y = 0f;
right.y = 0f;
forward.Normalize();
right.Normalize();
switch (direction)
{
case MazeDirection.Forward:
return forward;
case MazeDirection.Backward:
return -forward;
case MazeDirection.Left:
return -right;
case MazeDirection.Right:
return right;
case MazeDirection.None:
default:
return Vector3.zero;
}
}
private void PlaceOnGround(
ref Vector3 position,
ref Quaternion rotation,
Vector3 moveDirection
)
{
if (!useGroundRaycast)
{
position.y = fallbackGroundY + groundOffset;
return;
}
Vector3 rayStart = position + Vector3.up * raycastHeight;
if (Physics.Raycast(rayStart, Vector3.down, out RaycastHit hit, raycastDistance, groundMask))
{
position = hit.point + hit.normal * groundOffset;
Vector3 projectedForward =
Vector3.ProjectOnPlane(moveDirection, hit.normal).normalized;
if (projectedForward.sqrMagnitude > 0.001f)
rotation = Quaternion.LookRotation(projectedForward, hit.normal);
}
else
{
position.y = fallbackGroundY + groundOffset;
}
}
public void ClearFootprints()
{
foreach (GameObject footprint in spawnedFootprints)
{
if (footprint != null)
Destroy(footprint);
}
spawnedFootprints.Clear();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ea80bc964f8932649a840b3fd8cbf34f

View File

@@ -0,0 +1,8 @@
public enum MazeDirection
{
None,
Forward,
Backward,
Left,
Right
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4dbf81c4c8135684d934e97d4158abae

View File

@@ -0,0 +1,167 @@
using UnityEngine;
public class MazeGameManager : MonoBehaviour
{
[Header("VR Player Reference")]
[Tooltip("XR Origin 또는 Main Camera Transform을 넣으세요.")]
[SerializeField] private Transform playerTarget;
[Header("Managers")]
[SerializeField] private MazeUIManager mazeUI;
[SerializeField] private FootprintHintManager footprintHint;
[Header("Goal")]
[SerializeField] private Transform goal;
[SerializeField] private float goalDistance = 1.5f;
[Header("Checkpoints")]
[SerializeField] private Transform[] checkpoints;
[SerializeField] private float checkpointDistance = 1.5f;
[Header("Checkpoint Directions")]
[Tooltip("각 체크포인트에 도착했을 때 보여줄 발자국 방향입니다.")]
[SerializeField] private MazeDirection[] checkpointDirections;
[Header("VR Distance Option")]
[Tooltip("VR에서는 머리 높이가 달라지므로 보통 Y축 높이는 무시하는 것이 좋습니다.")]
[SerializeField] private bool ignoreHeight = true;
private bool[] reached;
private bool isCompleted;
private bool isFailed;
private void Awake()
{
InitializeCheckpoints();
}
private void Start()
{
ResetMaze();
}
private void Update()
{
if (isCompleted || isFailed)
return;
if (playerTarget == null)
return;
CheckCheckpoints();
CheckGoal();
}
private void InitializeCheckpoints()
{
int count = checkpoints != null ? checkpoints.Length : 0;
reached = new bool[count];
}
private void CheckCheckpoints()
{
if (checkpoints == null || checkpoints.Length == 0)
return;
for (int i = 0; i < checkpoints.Length; i++)
{
if (reached[i])
continue;
if (checkpoints[i] == null)
continue;
float distance = GetDistance(playerTarget.position, checkpoints[i].position);
if (distance <= checkpointDistance)
{
reached[i] = true;
MazeDirection direction = GetCheckpointDirection(i);
if (footprintHint != null)
footprintHint.ShowFootprints(direction);
}
}
}
private void CheckGoal()
{
if (goal == null)
return;
float distance = GetDistance(playerTarget.position, goal.position);
if (distance <= goalDistance)
Complete();
}
private float GetDistance(Vector3 a, Vector3 b)
{
if (ignoreHeight)
{
a.y = 0f;
b.y = 0f;
}
return Vector3.Distance(a, b);
}
private MazeDirection GetCheckpointDirection(int index)
{
if (checkpointDirections != null &&
index >= 0 &&
index < checkpointDirections.Length)
{
return checkpointDirections[index];
}
return MazeDirection.None;
}
private void Complete()
{
if (isCompleted || isFailed)
return;
isCompleted = true;
if (footprintHint != null)
footprintHint.ClearFootprints();
if (mazeUI != null)
mazeUI.ShowSuccess();
}
public void Fail()
{
if (isCompleted || isFailed)
return;
isFailed = true;
if (footprintHint != null)
footprintHint.ClearFootprints();
if (mazeUI != null)
mazeUI.ShowFail();
}
public void ResetMaze()
{
isCompleted = false;
isFailed = false;
if (reached == null || reached.Length != (checkpoints != null ? checkpoints.Length : 0))
InitializeCheckpoints();
for (int i = 0; i < reached.Length; i++)
reached[i] = false;
if (footprintHint != null)
footprintHint.ClearFootprints();
if (mazeUI != null)
mazeUI.HideReward();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b9aa32259300fd84f88c69548784c009

View File

@@ -0,0 +1,42 @@
using TMPro;
using UnityEngine;
public class MazeUIManager : MonoBehaviour
{
[Header("Result UI")]
[SerializeField] private GameObject rewardPanel;
[SerializeField] private TextMeshProUGUI rewardText;
private void Awake()
{
HideReward();
}
public void ShowSuccess()
{
ShowResult("SUCCESS!", Color.green);
}
public void ShowFail()
{
ShowResult("FAIL!", Color.red);
}
private void ShowResult(string message, Color color)
{
if (rewardPanel != null)
rewardPanel.SetActive(true);
if (rewardText != null)
{
rewardText.text = message;
rewardText.color = color;
}
}
public void HideReward()
{
if (rewardPanel != null)
rewardPanel.SetActive(false);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a006d8153489a634697983539bc6d7f5