Merge branch 'main' of https://www.nakjungit.site/sharedacc520k/WhaleAdventure_VR
This commit is contained in:
Binary file not shown.
@@ -1,15 +1,47 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.Interaction.Toolkit.Locomotion.Movement;
|
||||
|
||||
public class PlayerController : MonoBehaviour,ISceneInitializable
|
||||
public class PlayerController : MonoBehaviour, ISceneInitializable
|
||||
{
|
||||
[Header("점프 설정")]
|
||||
[SerializeField] private float _jumpHeight = 1.2f;
|
||||
|
||||
private Vector3 _playerVelocity;
|
||||
private CharacterController _controller;
|
||||
private ContinuousMoveProvider _moveProvider;
|
||||
private float gravityValue = Physics.gravity.y;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_controller = GetComponentInChildren<CharacterController>(true);
|
||||
_moveProvider = GetComponentInChildren<ContinuousMoveProvider>(true);
|
||||
}
|
||||
|
||||
public void OnSceneLoaded()
|
||||
{
|
||||
// 씬이 다시 로드돼도 한 번만 구독되도록 중복 제거 후 등록
|
||||
InputManager.Instance.OnJump_Event -= this.OnJump;
|
||||
InputManager.Instance.OnJump_Event += this.OnJump;
|
||||
}
|
||||
|
||||
public void OnJump()
|
||||
{
|
||||
|
||||
if (_controller == null) return;
|
||||
if (!_controller.isGrounded) return;
|
||||
|
||||
_playerVelocity.y = Mathf.Sqrt(_jumpHeight * -2f * gravityValue);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// 바닥 체크 및 Y축 속도 초기화
|
||||
if (_controller.isGrounded && _playerVelocity.y < 0)
|
||||
{
|
||||
// 완전히 0으로 두면 바닥 감지가 불안정할 수 있으므로 약간의 음수 값을 유지
|
||||
_playerVelocity.y = -2f;
|
||||
}
|
||||
|
||||
_playerVelocity.y += gravityValue * Time.deltaTime;
|
||||
_controller.Move(_playerVelocity * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Assets/04_Models/Hands/WoodHand/LeftHand_StylizedWood.prefab
LFS
Normal file
BIN
Assets/04_Models/Hands/WoodHand/LeftHand_StylizedWood.prefab
LFS
Normal file
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a534fd8b03ad4d4bb52186f1b14673e
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/04_Models/Hands/WoodHand/Poses/WHPose_GrabStick.asset
LFS
Normal file
BIN
Assets/04_Models/Hands/WoodHand/Poses/WHPose_GrabStick.asset
LFS
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44d9c2fc7cd20f041829401580b55417
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/04_Models/Hands/WoodHand/Poses/WHPose_Point.asset
LFS
Normal file
BIN
Assets/04_Models/Hands/WoodHand/Poses/WHPose_Point.asset
LFS
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b010d83e1b47a0b489dea53925158b33
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/04_Models/Hands/WoodHand/RightHand_StylizedWood.prefab
LFS
Normal file
BIN
Assets/04_Models/Hands/WoodHand/RightHand_StylizedWood.prefab
LFS
Normal file
Binary file not shown.
Binary file not shown.
BIN
Assets/04_Models/Player.prefab
LFS
Normal file
BIN
Assets/04_Models/Player.prefab
LFS
Normal file
Binary file not shown.
7
Assets/04_Models/Player.prefab.meta
Normal file
7
Assets/04_Models/Player.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 401911b5467339048803f487515483df
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user