diff --git a/Assets/Cube.prefab b/Assets/Cube.prefab new file mode 100644 index 0000000..ac9c9e3 --- /dev/null +++ b/Assets/Cube.prefab @@ -0,0 +1,114 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4416133559060049660 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8103763349234334894} + - component: {fileID: 7592977410710957088} + - component: {fileID: 758773052132879776} + - component: {fileID: 660534692806775076} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8103763349234334894 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4416133559060049660} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 149.49287, y: -0.73292, z: 24.06082} + 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!33 &7592977410710957088 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4416133559060049660} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &758773052132879776 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4416133559060049660} + 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: 2100000, guid: 8f047b861e188db4492aa9d5ef2c408e, type: 2} + 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!65 &660534692806775076 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4416133559060049660} + 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} diff --git a/Assets/Cube.prefab.meta b/Assets/Cube.prefab.meta new file mode 100644 index 0000000..138f7f2 --- /dev/null +++ b/Assets/Cube.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bbba2f965a48a1f41aa3aa75745eafc0 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Material/New Material 3.mat b/Assets/Material/New Material 3.mat new file mode 100644 index 0000000..53c903c --- /dev/null +++ b/Assets/Material/New Material 3.mat @@ -0,0 +1,137 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: New Material 3 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + 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: 0} + 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 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _XRMotionVectorsPass: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 0.19607843} + - _Color: {r: 1, g: 1, b: 1, a: 0.19607843} + - _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 +--- !u!114 &1668562327467827689 +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 diff --git a/Assets/Material/New Material 3.mat.meta b/Assets/Material/New Material 3.mat.meta new file mode 100644 index 0000000..7fe29e5 --- /dev/null +++ b/Assets/Material/New Material 3.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 14ab43a94d9146d448f6ea5373cabfb7 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/XR/Settings/OpenXRPackageSettings.asset b/Assets/XR/Settings/OpenXRPackageSettings.asset index 060a7a5..50424f1 100644 --- a/Assets/XR/Settings/OpenXRPackageSettings.asset +++ b/Assets/XR/Settings/OpenXRPackageSettings.asset @@ -1273,8 +1273,8 @@ MonoBehaviour: features: - {fileID: 7011443450567333355} - {fileID: -671281728444007487} - - {fileID: 6956056911768161135} - - {fileID: 5091991234558418143} + - {fileID: -901939997048047619} + - {fileID: -1734471456787174204} - {fileID: 8980318060753866109} - {fileID: -6559185765804338520} - {fileID: -4756202077021157709} @@ -1285,7 +1285,7 @@ MonoBehaviour: - {fileID: 348827886137839178} - {fileID: -7499073031166464939} - {fileID: 7666556398442971420} - - {fileID: 1118878472687837173} + - {fileID: 431653824124869831} - {fileID: 3985858319333531581} - {fileID: -6511185071715886993} - {fileID: -4363231183632145407} diff --git a/Assets/_Scenes/BossStage.unity b/Assets/_Scenes/BossStage.unity index 5a434a2..eb4749a 100644 --- a/Assets/_Scenes/BossStage.unity +++ b/Assets/_Scenes/BossStage.unity @@ -702,8 +702,8 @@ MonoBehaviour: groundAnchor: {fileID: 1519524653} k__BackingField: 10 k__BackingField: 5 - warningMarkerPrefab: {fileID: 878822567682098337, guid: 23f893a4670a7fc4180013174ddad3be, type: 3} - webPrefab: {fileID: 6774626840129085253} + warningMarkerPrefab: {fileID: 4416133559060049660, guid: bbba2f965a48a1f41aa3aa75745eafc0, type: 3} + webPrefab: {fileID: 7127456385706922585, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} --- !u!195 &139010308 NavMeshAgent: m_ObjectHideFlags: 0 @@ -745,7 +745,7 @@ BoxCollider: m_ProvidesContacts: 0 m_Enabled: 1 serializedVersion: 3 - m_Size: {x: 1, y: 1, z: 1} + m_Size: {x: 2, y: 2, z: 2} m_Center: {x: 0, y: 0, z: 1.2} --- !u!54 &139010317 Rigidbody: @@ -5083,6 +5083,96 @@ Transform: m_CorrespondingSourceObject: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3} m_PrefabInstance: {fileID: 1389076315} m_PrefabAsset: {fileID: 0} +--- !u!1 &1398221364 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1398221365} + - component: {fileID: 1398221368} + - component: {fileID: 1398221367} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1398221365 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1398221364} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.22, z: -0.32} + m_LocalScale: {x: 0.45, y: 0.25, z: 0.35} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1460420865} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &1398221367 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1398221364} + 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: 2100000, guid: 14ab43a94d9146d448f6ea5373cabfb7, type: 2} + 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 &1398221368 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1398221364} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &1428732631 GameObject: m_ObjectHideFlags: 0 @@ -5437,7 +5527,10 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] - m_AddedGameObjects: [] + m_AddedGameObjects: + - targetCorrespondingSourceObject: {fileID: 7917674758326848202, guid: 77e7c27b2c5525e4aa8cc9f99d654486, type: 3} + insertIndex: -1 + addedObject: {fileID: 1398221365} m_AddedComponents: - targetCorrespondingSourceObject: {fileID: 8806329115733545877, guid: 77e7c27b2c5525e4aa8cc9f99d654486, type: 3} insertIndex: -1 @@ -5496,7 +5589,12 @@ MonoBehaviour: maxForwardDistance: 0.5 minHeightOffset: -0.35 maxHeightOffset: -0.1 - requiredPoseTime: -0.3 + requiredPoseTime: 0.3 + poseExitDelay: 0.15 + guideRenderer: {fileID: 1398221367} + defaultColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.05} + chargingColor: {r: 1, g: 0.8, b: 0, a: 0.2} + successColor: {r: 0, g: 0.6, b: 1, a: 0.4} --- !u!54 &1460420867 Rigidbody: m_ObjectHideFlags: 0 @@ -5554,7 +5652,6 @@ MonoBehaviour: damageMultiplier: 10 hapticAmplitude: 0.5 hapticDuration: 0.1 - minParrySpeed: 1 parryStunDuration: 3 parryHapticAmplitude: 0.9 parryHapticDuration: 0.25 @@ -8053,68 +8150,6 @@ Transform: m_CorrespondingSourceObject: {fileID: 1031049542, guid: abc00000000006115142969020145011, type: 3} m_PrefabInstance: {fileID: 2132583849} m_PrefabAsset: {fileID: 0} ---- !u!1001 &5307503540508973421 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 7127456385706922585, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_Name - value: Thread - objectReference: {fileID: 0} - - target: {fileID: 8022518451160378288, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_LocalPosition.x - value: 83.62 - objectReference: {fileID: 0} - - target: {fileID: 8022518451160378288, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_LocalPosition.y - value: -8.22 - objectReference: {fileID: 0} - - target: {fileID: 8022518451160378288, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_LocalPosition.z - value: -7.05 - objectReference: {fileID: 0} - - target: {fileID: 8022518451160378288, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_LocalRotation.w - value: -0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 8022518451160378288, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_LocalRotation.x - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 8022518451160378288, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 8022518451160378288, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 8022518451160378288, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 270 - objectReference: {fileID: 0} - - target: {fileID: 8022518451160378288, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8022518451160378288, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} ---- !u!1 &6774626840129085253 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 7127456385706922585, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} - m_PrefabInstance: {fileID: 5307503540508973421} - m_PrefabAsset: {fileID: 0} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 @@ -8133,4 +8168,3 @@ SceneRoots: - {fileID: 1129977831} - {fileID: 1460420860} - {fileID: 1626958826} - - {fileID: 5307503540508973421} diff --git a/Assets/_Scripts/BossController.cs b/Assets/_Scripts/BossController.cs index d996c5d..7c2c19b 100644 --- a/Assets/_Scripts/BossController.cs +++ b/Assets/_Scripts/BossController.cs @@ -132,12 +132,14 @@ public class BossController : MonoBehaviour, IDamageble } } - public void TriggerParryStun() + public bool TriggerParryStun() { if (currentState is SpiderBiteState || currentState is SpiderChargeState) { ChangeState(); + return true; } + return false; } public void ResetChargeCooldown() diff --git a/Assets/_Scripts/VRInputPoseDetector.cs b/Assets/_Scripts/VRInputPoseDetector.cs index 2be0c08..b567a4a 100644 --- a/Assets/_Scripts/VRInputPoseDetector.cs +++ b/Assets/_Scripts/VRInputPoseDetector.cs @@ -2,57 +2,110 @@ using UnityEngine; public class VRInputPoseDetector : MonoBehaviour { + [Header("必須コンポーネント登録")] [SerializeField] private Transform headTransform; [SerializeField] private Transform rightHandTransform; [SerializeField] private Transform leftHandTransform; + + [Header("構えの判定範囲設定")] [SerializeField] private float minForwardDistance = 0.15f; [SerializeField] private float maxForwardDistance = 0.5f; [SerializeField] private float minHeightOffset = -0.35f; [SerializeField] private float maxHeightOffset = -0.1f; - [SerializeField] private float requiredPoseTime = -0.3f; + + [Header("タイマー・バッファ設定")] + [SerializeField] private float requiredPoseTime = 0.3f; + + [SerializeField] private float poseExitDelay = 0.15f; + + [Header("視覚フィードバック(ガイドUI設定)")] + [SerializeField] private Renderer guideRenderer; + [SerializeField] private Color defaultColor = new Color(0.5f, 0.5f, 0.5f, 0.05f); // 普段(超薄いグレー) + [SerializeField] private Color chargingColor = new Color(1f, 0.8f, 0f, 0.2f); // 溜め中(うっすら黄色) + [SerializeField] private Color successColor = new Color(0f, 0.6f, 1f, 0.4f); // 構え完了(綺麗な青シールド) + private float poseTimer = 0f; - private bool isPoseMainTained = false; - public bool IsPosing => isPoseMainTained; + private float exitTimer = 0f; + private bool isPoseMaintained = false; + + public bool IsPosing => isPoseMaintained; void Update() { - if(headTransform == null || rightHandTransform == null || leftHandTransform == null) return; + if (headTransform == null || rightHandTransform == null || leftHandTransform == null) return; - //両手の世界座標を頭を中心としたローカル座標に変換 + // 両手の世界座標を頭を中心としたローカル座標に変換 Vector3 localRightHand = headTransform.InverseTransformPoint(rightHandTransform.position); Vector3 localLeftHand = headTransform.InverseTransformPoint(leftHandTransform.position); - //両手が構え範囲に入っているかチェック + // 両手が構え範囲に入っているかチェック bool isRightHandGuarding = CheckHandPosition(localRightHand); bool isLeftHandGuarding = CheckHandPosition(localLeftHand); - //両手が構え範囲にある場合のタイマー処理 - if(isRightHandGuarding && isLeftHandGuarding) + bool isBothHandsGuarding = isRightHandGuarding && isLeftHandGuarding; + + // ─── 🛡️ チャタリング防止付き・構え判定ロジック ─── + if (isBothHandsGuarding) { - poseTimer += Time.deltaTime; - if(poseTimer >= requiredPoseTime && !isPoseMainTained) + // 範囲内に手が戻ったので、解除カウントダウンを即座にリセット + exitTimer = 0f; + + if (!isPoseMaintained) { - isPoseMainTained = true; - Debug.Log("kamaeseikou"); + poseTimer += Time.deltaTime; + if (poseTimer >= requiredPoseTime) + { + isPoseMaintained = true; + Debug.Log("🛡️ 【構え成功】 パリィ受付がアクティブになりました。"); + } } } else { - poseTimer = 0f; - if(isPoseMainTained) + // 範囲外に出た場合 + poseTimer = 0f; // まだ構えが完了していない段階(溜め中)なら即リセット + + if (isPoseMaintained) { - isPoseMainTained = false; - Debug.Log("kamaesippai"); + // すでに構えが成功している状態なら、猶予タイマーを開始(ここで即解除しない!) + exitTimer += Time.deltaTime; + + if (exitTimer >= poseExitDelay) + { + isPoseMaintained = false; + exitTimer = 0f; + Debug.Log("❌ 【構え解除】 猶予時間を超えたためガードが解けました。"); + } } } + + UpdateVisualFeedback(isBothHandsGuarding); } - // private bool CheckHandPosition(Vector3 localHandPos) { - bool inForwardRange = localHandPos.z >= minForwardDistance && localHandPos.z <= maxForwardDistance; //Z軸:頭より前に手があるか - bool inHeightRange = localHandPos.y >= minHeightOffset && localHandPos.y <= maxHeightOffset; //Y軸:手の高さが適切か + bool inForwardRange = localHandPos.z >= minForwardDistance && localHandPos.z <= maxForwardDistance; // Z軸:頭より前に手があるか + bool inHeightRange = localHandPos.y >= minHeightOffset && localHandPos.y <= maxHeightOffset; // Y軸:手の高さが適切か return inForwardRange && inHeightRange; } -} + + private void UpdateVisualFeedback(bool isBothHandsGuarding) + { + if (guideRenderer == null) return; + + // ボスの攻撃を見やすくするため、現在の状態に応じてガイドシールドのカラーを3段階可変させる + if (isPoseMaintained) + { + guideRenderer.material.color = successColor; // 成功:青シールド + } + else if (isBothHandsGuarding) + { + guideRenderer.material.color = chargingColor; // 溜め中:黄色 + } + else + { + guideRenderer.material.color = defaultColor; // 構えなし:目立たない透明グレー + } + } +} \ No newline at end of file diff --git a/Assets/_Scripts/VRPunchAttack.cs b/Assets/_Scripts/VRPunchAttack.cs index ecff263..7f7a779 100644 --- a/Assets/_Scripts/VRPunchAttack.cs +++ b/Assets/_Scripts/VRPunchAttack.cs @@ -11,17 +11,15 @@ public class VRInputPunch : MonoBehaviour [SerializeField] private VRInputPoseDetector poseDetector; [Header("攻撃(パンチ)設定")] - [SerializeField] private float minPunchSpeed = 2.0f; // パンチとして判定する最低速度 (m/s) + [SerializeField] private float minPunchSpeed = 1.0f; // パンチとして判定する最低速度 (m/s) [SerializeField] private float damageMultiplier = 10.0f; // ダメージ倍率 [SerializeField] private float hapticAmplitude = 0.5f; // 通常ヒットの振動の強さ [SerializeField] private float hapticDuration = 0.1f; // 通常ヒットの振動の長さ [Header("パリィ設定")] - [SerializeField] private float minParrySpeed = 1.0f; // パリィできるパンチとして判定する最低速度 (m/s) [SerializeField] private float parryStunDuration = 3.0f; // スタン時間(秒) [SerializeField] private float parryHapticAmplitude = 0.9f; // パリィ成功時の振動の強さ [SerializeField] private float parryHapticDuration = 0.25f; // パリィ成功時の振動の長さ - // ───────────────────────────────────────── private void OnEnable() { @@ -72,16 +70,17 @@ public class VRInputPunch : MonoBehaviour BossController boss = other.GetComponentInParent(); if (boss != null) { - boss.TriggerParryStun(); + if(boss.TriggerParryStun()) + { TriggerHaptics(parryHapticAmplitude, parryHapticDuration); Debug.Log("🛡️ 【ジャストパリィ成功!】 ボスの体勢を崩しました!"); return; + } } } Debug.Log("🧱 ガード(構え不足):敵の攻撃は防いだが、弾き返せなかった。"); - return; }