0727
This commit is contained in:
Binary file not shown.
84
Assets/02_Scripts/Story/PlayerPushToPoint.cs
Normal file
84
Assets/02_Scripts/Story/PlayerPushToPoint.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerPushToPoint : MonoBehaviour
|
||||
{
|
||||
[Header("Player")]
|
||||
[SerializeField] private Transform xrOrigin;
|
||||
[SerializeField] private Transform playerCamera;
|
||||
[SerializeField] private CharacterController characterController;
|
||||
|
||||
[Header("Target")]
|
||||
[SerializeField] private Transform pushDirectionPoint;
|
||||
|
||||
[Header("Push")]
|
||||
[SerializeField] private float pushDuration = 0.2f;
|
||||
|
||||
private bool hasPushed;
|
||||
private bool isPushing;
|
||||
|
||||
// 타임라인에서 충돌 순간에 호출
|
||||
public void PushPlayerOnce()
|
||||
{
|
||||
if (hasPushed || isPushing)
|
||||
return;
|
||||
|
||||
if (xrOrigin == null || playerCamera == null || pushDirectionPoint == null)
|
||||
{
|
||||
Debug.LogWarning("플레이어 밀기 설정이 비어 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
hasPushed = true;
|
||||
StartCoroutine(PushRoutine());
|
||||
}
|
||||
|
||||
private IEnumerator PushRoutine()
|
||||
{
|
||||
isPushing = true;
|
||||
|
||||
// 카메라의 현재 위치가 목표 지점까지 가기 위해 필요한 이동량
|
||||
Vector3 totalMovement =
|
||||
pushDirectionPoint.position - playerCamera.position;
|
||||
|
||||
// VR 플레이어 높이는 변경하지 않음
|
||||
totalMovement.y = 0f;
|
||||
|
||||
float elapsed = 0f;
|
||||
Vector3 movedAmount = Vector3.zero;
|
||||
|
||||
while (elapsed < pushDuration)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
|
||||
float t = Mathf.Clamp01(elapsed / pushDuration);
|
||||
|
||||
// 처음에 빠르게 밀리고 끝에서 부드럽게 멈춤
|
||||
float easedT = 1f - Mathf.Pow(1f - t, 3f);
|
||||
|
||||
Vector3 targetMovement = totalMovement * easedT;
|
||||
Vector3 frameMovement = targetMovement - movedAmount;
|
||||
|
||||
if (characterController != null &&
|
||||
characterController.enabled)
|
||||
{
|
||||
characterController.Move(frameMovement);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrOrigin.position += frameMovement;
|
||||
}
|
||||
|
||||
movedAmount = targetMovement;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
isPushing = false;
|
||||
}
|
||||
|
||||
// 반복 테스트할 때만 사용
|
||||
public void ResetPush()
|
||||
{
|
||||
hasPushed = false;
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Story/PlayerPushToPoint.cs.meta
Normal file
2
Assets/02_Scripts/Story/PlayerPushToPoint.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6ef75fbf5bbf2145a1a11c3f77e6c56
|
||||
@@ -265,7 +265,6 @@ MonoBehaviour:
|
||||
- TalkText
|
||||
- Gesture
|
||||
- Expression
|
||||
- Voice
|
||||
- Bgm
|
||||
- Vfx
|
||||
- LineDuration
|
||||
@@ -276,6 +275,7 @@ MonoBehaviour:
|
||||
- WaitForInput
|
||||
- Affection
|
||||
- Progress
|
||||
- Voice
|
||||
m_ValueList:
|
||||
- rid: 8016363908462280799
|
||||
- rid: 8016363908462280800
|
||||
@@ -288,7 +288,6 @@ MonoBehaviour:
|
||||
- rid: 8016363908462280807
|
||||
- rid: 8016363908462280808
|
||||
- rid: 8016363908462280809
|
||||
- rid: 8016363908462280810
|
||||
- rid: 8016363908462280811
|
||||
- rid: 8016363908462280812
|
||||
- rid: 8016363908462280813
|
||||
@@ -299,6 +298,7 @@ MonoBehaviour:
|
||||
- rid: 8016363908462280818
|
||||
- rid: 8016363908462280819
|
||||
- rid: 8016363908462280820
|
||||
- rid: 8016363972690969383
|
||||
m_InputPortInfos:
|
||||
expandedPortsById:
|
||||
m_KeyList: []
|
||||
@@ -393,10 +393,6 @@ MonoBehaviour:
|
||||
type: {class: 'Constant`1[[ExpressionData, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363908462280810
|
||||
type: {class: 'Constant`1[[VoiceClip, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363908462280811
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
@@ -469,7 +465,6 @@ MonoBehaviour:
|
||||
- TalkText
|
||||
- Gesture
|
||||
- Expression
|
||||
- Voice
|
||||
- Bgm
|
||||
- Vfx
|
||||
- LineDuration
|
||||
@@ -480,6 +475,7 @@ MonoBehaviour:
|
||||
- WaitForInput
|
||||
- Affection
|
||||
- Progress
|
||||
- Voice
|
||||
m_ValueList:
|
||||
- rid: 8016363972690968760
|
||||
- rid: 8016363972690968761
|
||||
@@ -492,7 +488,6 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968768
|
||||
- rid: 8016363972690968769
|
||||
- rid: 8016363972690968770
|
||||
- rid: 8016363972690968771
|
||||
- rid: 8016363972690968772
|
||||
- rid: 8016363972690968773
|
||||
- rid: 8016363972690968774
|
||||
@@ -503,6 +498,7 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968779
|
||||
- rid: 8016363972690968780
|
||||
- rid: 8016363972690968781
|
||||
- rid: 8016363972690969384
|
||||
m_InputPortInfos:
|
||||
expandedPortsById:
|
||||
m_KeyList: []
|
||||
@@ -597,10 +593,6 @@ MonoBehaviour:
|
||||
type: {class: 'Constant`1[[ExpressionData, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968771
|
||||
type: {class: 'Constant`1[[VoiceClip, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968772
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
@@ -673,7 +665,6 @@ MonoBehaviour:
|
||||
- TalkText
|
||||
- Gesture
|
||||
- Expression
|
||||
- Voice
|
||||
- Bgm
|
||||
- Vfx
|
||||
- LineDuration
|
||||
@@ -689,6 +680,7 @@ MonoBehaviour:
|
||||
- Choice0Code
|
||||
- Choice1Text
|
||||
- Choice1Code
|
||||
- Voice
|
||||
m_ValueList:
|
||||
- rid: 8016363972690968785
|
||||
- rid: 8016363972690968786
|
||||
@@ -701,7 +693,6 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968793
|
||||
- rid: 8016363972690968794
|
||||
- rid: 8016363972690968795
|
||||
- rid: 8016363972690968796
|
||||
- rid: 8016363972690968797
|
||||
- rid: 8016363972690968798
|
||||
- rid: 8016363972690968799
|
||||
@@ -717,6 +708,7 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968810
|
||||
- rid: 8016363972690968811
|
||||
- rid: 8016363972690968812
|
||||
- rid: 8016363972690969385
|
||||
m_InputPortInfos:
|
||||
expandedPortsById:
|
||||
m_KeyList: []
|
||||
@@ -810,10 +802,6 @@ MonoBehaviour:
|
||||
type: {class: 'Constant`1[[ExpressionData, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968796
|
||||
type: {class: 'Constant`1[[VoiceClip, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968797
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
@@ -912,7 +900,6 @@ MonoBehaviour:
|
||||
- TalkText
|
||||
- Gesture
|
||||
- Expression
|
||||
- Voice
|
||||
- Bgm
|
||||
- Vfx
|
||||
- LineDuration
|
||||
@@ -923,6 +910,7 @@ MonoBehaviour:
|
||||
- WaitForInput
|
||||
- Affection
|
||||
- Progress
|
||||
- Voice
|
||||
m_ValueList:
|
||||
- rid: 8016363972690968815
|
||||
- rid: 8016363972690968816
|
||||
@@ -935,7 +923,6 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968823
|
||||
- rid: 8016363972690968824
|
||||
- rid: 8016363972690968825
|
||||
- rid: 8016363972690968826
|
||||
- rid: 8016363972690968827
|
||||
- rid: 8016363972690968828
|
||||
- rid: 8016363972690968829
|
||||
@@ -946,6 +933,7 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968834
|
||||
- rid: 8016363972690968835
|
||||
- rid: 8016363972690968836
|
||||
- rid: 8016363972690969386
|
||||
m_InputPortInfos:
|
||||
expandedPortsById:
|
||||
m_KeyList: []
|
||||
@@ -1041,10 +1029,6 @@ MonoBehaviour:
|
||||
type: {class: 'Constant`1[[ExpressionData, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968826
|
||||
type: {class: 'Constant`1[[VoiceClip, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968827
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
@@ -1117,7 +1101,6 @@ MonoBehaviour:
|
||||
- TalkText
|
||||
- Gesture
|
||||
- Expression
|
||||
- Voice
|
||||
- Bgm
|
||||
- Vfx
|
||||
- LineDuration
|
||||
@@ -1128,6 +1111,7 @@ MonoBehaviour:
|
||||
- WaitForInput
|
||||
- Affection
|
||||
- Progress
|
||||
- Voice
|
||||
m_ValueList:
|
||||
- rid: 8016363972690968840
|
||||
- rid: 8016363972690968841
|
||||
@@ -1140,7 +1124,6 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968848
|
||||
- rid: 8016363972690968849
|
||||
- rid: 8016363972690968850
|
||||
- rid: 8016363972690968851
|
||||
- rid: 8016363972690968852
|
||||
- rid: 8016363972690968853
|
||||
- rid: 8016363972690968854
|
||||
@@ -1151,6 +1134,7 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968859
|
||||
- rid: 8016363972690968860
|
||||
- rid: 8016363972690968861
|
||||
- rid: 8016363972690969387
|
||||
m_InputPortInfos:
|
||||
expandedPortsById:
|
||||
m_KeyList: []
|
||||
@@ -1247,10 +1231,6 @@ MonoBehaviour:
|
||||
type: {class: 'Constant`1[[ExpressionData, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968851
|
||||
type: {class: 'Constant`1[[VoiceClip, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968852
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
@@ -1323,7 +1303,6 @@ MonoBehaviour:
|
||||
- TalkText
|
||||
- Gesture
|
||||
- Expression
|
||||
- Voice
|
||||
- Bgm
|
||||
- Vfx
|
||||
- LineDuration
|
||||
@@ -1334,6 +1313,7 @@ MonoBehaviour:
|
||||
- WaitForInput
|
||||
- Affection
|
||||
- Progress
|
||||
- Voice
|
||||
m_ValueList:
|
||||
- rid: 8016363972690968865
|
||||
- rid: 8016363972690968866
|
||||
@@ -1346,7 +1326,6 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968873
|
||||
- rid: 8016363972690968874
|
||||
- rid: 8016363972690968875
|
||||
- rid: 8016363972690968876
|
||||
- rid: 8016363972690968877
|
||||
- rid: 8016363972690968878
|
||||
- rid: 8016363972690968879
|
||||
@@ -1357,6 +1336,7 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968884
|
||||
- rid: 8016363972690968885
|
||||
- rid: 8016363972690968886
|
||||
- rid: 8016363972690969388
|
||||
m_InputPortInfos:
|
||||
expandedPortsById:
|
||||
m_KeyList: []
|
||||
@@ -1452,10 +1432,6 @@ MonoBehaviour:
|
||||
type: {class: 'Constant`1[[ExpressionData, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968876
|
||||
type: {class: 'Constant`1[[VoiceClip, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968877
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
@@ -1528,7 +1504,6 @@ MonoBehaviour:
|
||||
- TalkText
|
||||
- Gesture
|
||||
- Expression
|
||||
- Voice
|
||||
- Bgm
|
||||
- Vfx
|
||||
- LineDuration
|
||||
@@ -1539,6 +1514,7 @@ MonoBehaviour:
|
||||
- WaitForInput
|
||||
- Affection
|
||||
- Progress
|
||||
- Voice
|
||||
m_ValueList:
|
||||
- rid: 8016363972690968890
|
||||
- rid: 8016363972690968891
|
||||
@@ -1551,7 +1527,6 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968898
|
||||
- rid: 8016363972690968899
|
||||
- rid: 8016363972690968900
|
||||
- rid: 8016363972690968901
|
||||
- rid: 8016363972690968902
|
||||
- rid: 8016363972690968903
|
||||
- rid: 8016363972690968904
|
||||
@@ -1562,6 +1537,7 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968909
|
||||
- rid: 8016363972690968910
|
||||
- rid: 8016363972690968911
|
||||
- rid: 8016363972690969389
|
||||
m_InputPortInfos:
|
||||
expandedPortsById:
|
||||
m_KeyList: []
|
||||
@@ -1657,10 +1633,6 @@ MonoBehaviour:
|
||||
type: {class: 'Constant`1[[ExpressionData, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968901
|
||||
type: {class: 'Constant`1[[VoiceClip, Assembly-CSharp]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690968902
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
@@ -1704,3 +1676,31 @@ MonoBehaviour:
|
||||
- rid: 8016363972690968912
|
||||
type: {class: DialogLineNode, ns: DinoLove.Dialog.GraphTool.Editor, asm: Assembly-CSharp-Editor}
|
||||
data:
|
||||
- rid: 8016363972690969383
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690969384
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690969385
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690969386
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690969387
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690969388
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
- rid: 8016363972690969389
|
||||
type: {class: 'Constant`1[[UnityEngine.AudioClip, UnityEngine.AudioModule]]', ns: Unity.GraphToolkit.Editor, asm: UnityEditor.GraphToolkitModule}
|
||||
data:
|
||||
m_Value: {fileID: 0}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user