2026-03-17 14:19 FPS시점의 Strafe캐릭터 조작과 에임모드 전환
This commit is contained in:
BIN
Assets/01_Scenes/GameScene.unity
LFS
BIN
Assets/01_Scenes/GameScene.unity
LFS
Binary file not shown.
@@ -11,6 +11,10 @@ public class GameManager : MonoBehaviour
|
|||||||
public LevelManager Level { get; private set; }
|
public LevelManager Level { get; private set; }
|
||||||
public CameraManager Camera { get; private set; }
|
public CameraManager Camera { get; private set; }
|
||||||
|
|
||||||
|
//UI
|
||||||
|
public IntroUIManager IntroUI { get; private set; }
|
||||||
|
public InGameUIManager InGameUI { get; private set; }
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
if (Instance == null)
|
if (Instance == null)
|
||||||
@@ -29,15 +33,16 @@ private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
|||||||
{
|
{
|
||||||
// 씬이 로드될 때마다 해당 씬에 있는 Manager들을 찾아서 갱신
|
// 씬이 로드될 때마다 해당 씬에 있는 Manager들을 찾아서 갱신
|
||||||
// 없으면 자동으로 null이 들어감
|
// 없으면 자동으로 null이 들어감
|
||||||
Level = FindFirstObjectByType<LevelManager>();
|
this.Level = FindFirstObjectByType<LevelManager>();
|
||||||
Camera = FindFirstObjectByType<CameraManager>();
|
this.Camera = FindFirstObjectByType<CameraManager>();
|
||||||
|
this.IntroUI = FindFirstObjectByType<IntroUIManager>();
|
||||||
if(Level != null) Level.OnSceneLoaded(scene, mode);
|
this.InGameUI = FindFirstObjectByType<InGameUIManager>();
|
||||||
if(Camera != null) Camera.OnSceneLoaded(scene, mode);
|
|
||||||
|
if (this.Level != null) this.Level.OnSceneLoaded(scene, mode);
|
||||||
|
if (this.Camera != null) this.Camera.OnSceneLoaded(scene, mode);
|
||||||
|
|
||||||
InputManager.Instance.PlayerInputEnable(true);
|
InputManager.Instance.PlayerInputEnable(true);
|
||||||
GlobalUIManager.Instance.SetSceneLoadingActive(false);
|
GlobalUIManager.Instance.SetSceneLoadingActive(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestSceneChange(string sceneName)
|
public void RequestSceneChange(string sceneName)
|
||||||
|
|||||||
@@ -20,9 +20,12 @@ public class InputManager : MonoBehaviour
|
|||||||
public event Action<Vector2> OnMoveEvent;
|
public event Action<Vector2> OnMoveEvent;
|
||||||
public event Action<InputState> OnSprintEvent;
|
public event Action<InputState> OnSprintEvent;
|
||||||
public event Action<InputState> OnJumpEvent;
|
public event Action<InputState> OnJumpEvent;
|
||||||
|
public event Action<InputState> OnAimToggleEvent;
|
||||||
|
public event Action<Vector2> OnLookEvent;
|
||||||
public event Action OnNormalAttackEvent;
|
public event Action OnNormalAttackEvent;
|
||||||
public event Action OnHeavyAttackEvent;
|
public event Action OnHeavyAttackEvent;
|
||||||
|
|
||||||
|
|
||||||
//키조작
|
//키조작
|
||||||
public event Action OnKeyDown_UpArrowEvent;
|
public event Action OnKeyDown_UpArrowEvent;
|
||||||
public event Action OnKeyDown_DownArrowEvent;
|
public event Action OnKeyDown_DownArrowEvent;
|
||||||
@@ -95,8 +98,11 @@ public void SetCharacterInputMap(string mapName)
|
|||||||
BindActionCharacter("Move", OnMove);
|
BindActionCharacter("Move", OnMove);
|
||||||
BindActionCharacter("Sprint", OnSprint);
|
BindActionCharacter("Sprint", OnSprint);
|
||||||
BindActionCharacter("Jump", OnJump);
|
BindActionCharacter("Jump", OnJump);
|
||||||
|
BindActionCharacter("AimToggle", OnAimToggle);
|
||||||
|
BindActionCharacter("Look", OnLook);
|
||||||
BindActionCharacter("NormalAttack", OnNormalAttack);
|
BindActionCharacter("NormalAttack", OnNormalAttack);
|
||||||
BindActionCharacter("HeavyAttack", OnHeavyAttack);
|
BindActionCharacter("HeavyAttack", OnHeavyAttack);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//매핑용 함수
|
//매핑용 함수
|
||||||
@@ -171,7 +177,18 @@ private void OnJump(InputAction.CallbackContext ctx)
|
|||||||
OnJumpEvent?.Invoke(InputState.Canceled);
|
OnJumpEvent?.Invoke(InputState.Canceled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void OnAimToggle(InputAction.CallbackContext ctx)
|
||||||
|
{
|
||||||
|
if (ctx.started)
|
||||||
|
{
|
||||||
|
OnAimToggleEvent?.Invoke(InputState.Started);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void OnLook(InputAction.CallbackContext ctx)
|
||||||
|
{
|
||||||
|
Vector2 look = ctx.ReadValue<Vector2>();
|
||||||
|
OnLookEvent?.Invoke(look);
|
||||||
|
}
|
||||||
private void OnNormalAttack(InputAction.CallbackContext ctx)
|
private void OnNormalAttack(InputAction.CallbackContext ctx)
|
||||||
{
|
{
|
||||||
OnNormalAttackEvent?.Invoke();
|
OnNormalAttackEvent?.Invoke();
|
||||||
@@ -193,7 +210,7 @@ private void OnKeyDown_UpArrow(InputAction.CallbackContext ctx)
|
|||||||
private void OnKeyDown_DownArrow(InputAction.CallbackContext ctx)
|
private void OnKeyDown_DownArrow(InputAction.CallbackContext ctx)
|
||||||
{
|
{
|
||||||
if (ctx.started)
|
if (ctx.started)
|
||||||
OnKeyDown_UpArrowEvent?.Invoke();
|
OnKeyDown_DownArrowEvent?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnKeyDown_Enter(InputAction.CallbackContext ctx)
|
private void OnKeyDown_Enter(InputAction.CallbackContext ctx)
|
||||||
|
|||||||
@@ -35,9 +35,10 @@ private async Awaitable InitializeCameraRig()
|
|||||||
await Awaitable.NextFrameAsync();
|
await Awaitable.NextFrameAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (brain.ActiveVirtualCamera is CinemachineCamera cam)
|
// 가져오는게 실제 cinemachine카메라가 아니라 매니저일수도 있기에 MonoBehaviour로 변환후 찾기
|
||||||
|
if (brain.ActiveVirtualCamera is MonoBehaviour activeComponent)
|
||||||
{
|
{
|
||||||
_currentCameraRig = cam.GetComponentInParent<CameraRigBase>();
|
_currentCameraRig = activeComponent.GetComponentInParent<CameraRigBase>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,11 +47,16 @@ public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCameraRig(AimCameraRig cameraRig)
|
public void SetCameraRig(CameraRigBase cameraRig)
|
||||||
{
|
{
|
||||||
_currentCameraRig = cameraRig;
|
_currentCameraRig = cameraRig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CinemachineCamera GetLiveCinemachineCamera()
|
||||||
|
{
|
||||||
|
return _currentCameraRig.LiveCmCamera;
|
||||||
|
}
|
||||||
|
|
||||||
public void ZoomCamera(float offset)
|
public void ZoomCamera(float offset)
|
||||||
{
|
{
|
||||||
if (_currentCameraRig is AimCameraRig rig)
|
if (_currentCameraRig is AimCameraRig rig)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class LevelManager : MonoBehaviour
|
|||||||
[SerializeField] private GameObject[] _playableCharacterPrefabs; //플레이어가 될수 있는 캐릭터들 프리팹 할당
|
[SerializeField] private GameObject[] _playableCharacterPrefabs; //플레이어가 될수 있는 캐릭터들 프리팹 할당
|
||||||
public GameObject[] PlayableCharacterPrefabs { get { return _playableCharacterPrefabs; } private set { _playableCharacterPrefabs = value; } }
|
public GameObject[] PlayableCharacterPrefabs { get { return _playableCharacterPrefabs; } private set { _playableCharacterPrefabs = value; } }
|
||||||
public GameObject CurrentCharacter { get; private set; } // 현재 캐릭터
|
public GameObject CurrentCharacter { get; private set; } // 현재 캐릭터
|
||||||
public PlayerCharacterController CurrentCharacterController { get { return CurrentCharacter?.GetComponent<PlayerCharacterController>(); } } // 현재 캐릭터의 컨트롤러
|
public PlayerCharacterController CurrentCharacterController { get { return CurrentCharacter == null ? null : CurrentCharacter.GetComponent<PlayerCharacterController>(); } } // 현재 캐릭터의 컨트롤러
|
||||||
public int CurrentCharacterIdx { get; private set; } //현재캐릭터 인덱스
|
public int CurrentCharacterIdx { get; private set; } //현재캐릭터 인덱스
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -102,6 +102,8 @@ public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
|||||||
InputManager.Instance.OnMoveEvent += CurrentCharacterController.MoveInput;
|
InputManager.Instance.OnMoveEvent += CurrentCharacterController.MoveInput;
|
||||||
InputManager.Instance.OnSprintEvent += CurrentCharacterController.SprintInput;
|
InputManager.Instance.OnSprintEvent += CurrentCharacterController.SprintInput;
|
||||||
InputManager.Instance.OnJumpEvent += CurrentCharacterController.JumpInput;
|
InputManager.Instance.OnJumpEvent += CurrentCharacterController.JumpInput;
|
||||||
|
InputManager.Instance.OnAimToggleEvent += CurrentCharacterController.AimToggleInput;
|
||||||
|
InputManager.Instance.OnLookEvent += CurrentCharacterController.LookInput;
|
||||||
//InputManager.Instance.OnNormalAttackEvent;
|
//InputManager.Instance.OnNormalAttackEvent;
|
||||||
//InputManager.Instance.OnHeavyAttackEvent;
|
//InputManager.Instance.OnHeavyAttackEvent;
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,10 @@
|
|||||||
|
|
||||||
public class InGameUIManager : BaseUIManager
|
public class InGameUIManager : BaseUIManager
|
||||||
{
|
{
|
||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
[SerializeField] private GameObject _crosshairRoot;
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
public void VisibleCrossHair(bool isOn)
|
||||||
void Update()
|
|
||||||
{
|
{
|
||||||
|
_crosshairRoot.SetActive(isOn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
public class AimCameraRig : CameraRigBase
|
public class AimCameraRig : CameraRigBase
|
||||||
{
|
{
|
||||||
public InputAxis AimMode = InputAxis.DefaultMomentary; //누르는 동안만 유지
|
|
||||||
|
|
||||||
[SerializeField] private CinemachineCamera _aimCamera;
|
[SerializeField] private CinemachineCamera _aimCamera;
|
||||||
[SerializeField] private CinemachineCamera _freeCamera;
|
[SerializeField] private CinemachineCamera _freeCamera;
|
||||||
|
|
||||||
@@ -16,7 +14,7 @@ public class AimCameraRig : CameraRigBase
|
|||||||
|
|
||||||
public CinemachineCamera ActiveCmCamera => LiveChild as CinemachineCamera;
|
public CinemachineCamera ActiveCmCamera => LiveChild as CinemachineCamera;
|
||||||
|
|
||||||
private bool _isAiming => AimMode.Value > 0.5f;
|
private bool _isAiming => _controller != null && _controller.IsAiming;
|
||||||
private float _lastKnownFOV = 60f;
|
private float _lastKnownFOV = 60f;
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
@@ -55,7 +53,6 @@ protected override void Start()
|
|||||||
public override void GetInputAxes(List<IInputAxisOwner.AxisDescriptor> axes)
|
public override void GetInputAxes(List<IInputAxisOwner.AxisDescriptor> axes)
|
||||||
{
|
{
|
||||||
base.GetInputAxes(axes);
|
base.GetInputAxes(axes);
|
||||||
axes.Add(new() { DrivenAxis = () => ref AimMode, Name = "Aim" });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override CinemachineVirtualCameraBase ChooseCurrentCamera(Vector3 worldUp, float deltaTime)
|
protected override CinemachineVirtualCameraBase ChooseCurrentCamera(Vector3 worldUp, float deltaTime)
|
||||||
@@ -63,10 +60,17 @@ protected override CinemachineVirtualCameraBase ChooseCurrentCamera(Vector3 worl
|
|||||||
var oldCam = (CinemachineVirtualCameraBase)LiveChild;
|
var oldCam = (CinemachineVirtualCameraBase)LiveChild;
|
||||||
var newCam = _isAiming ? _aimCamera : _freeCamera;
|
var newCam = _isAiming ? _aimCamera : _freeCamera;
|
||||||
if (_controller != null && oldCam != newCam)
|
if (_controller != null && oldCam != newCam)
|
||||||
{
|
{
|
||||||
_controller.RotationMode = _isAiming
|
//에임모드에서 다시 돌아갈때 플레이어의 현재 회전값에 카메라를 일치시킴
|
||||||
? PlayerCharacterController.PlayerRotationMode.CameraCoupled
|
if(newCam == _freeCamera)
|
||||||
: PlayerCharacterController.PlayerRotationMode.CameraDecoupled;
|
{
|
||||||
|
CinemachineOrbitalFollow orbitalFollow = newCam.GetComponent<CinemachineOrbitalFollow>();
|
||||||
|
|
||||||
|
orbitalFollow.HorizontalAxis.Recentering.Enabled = true;
|
||||||
|
orbitalFollow.VerticalAxis.Recentering.Enabled = true;
|
||||||
|
orbitalFollow.HorizontalAxis.Recentering.Enabled = false;
|
||||||
|
orbitalFollow.VerticalAxis.Recentering.Enabled = false;
|
||||||
|
}
|
||||||
_controller.RecenterPlayer();
|
_controller.RecenterPlayer();
|
||||||
}
|
}
|
||||||
return newCam;
|
return newCam;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
public abstract class CameraRigBase : CinemachineCameraManagerBase, IInputAxisOwner
|
public abstract class CameraRigBase : CinemachineCameraManagerBase, IInputAxisOwner
|
||||||
{
|
{
|
||||||
protected PlayerCharacterController _controller;
|
protected PlayerCharacterController _controller;
|
||||||
|
|
||||||
protected abstract IReadOnlyList<CinemachineVirtualCameraBase> CameraCandidates { get; }
|
protected abstract IReadOnlyList<CinemachineVirtualCameraBase> CameraCandidates { get; }
|
||||||
|
public CinemachineCamera LiveCmCamera => LiveChild as CinemachineCamera;
|
||||||
|
|
||||||
protected virtual void Awake()
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,13 +2,16 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Unity.Cinemachine;
|
using Unity.Cinemachine;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
|
using UnityEditorInternal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static Unity.Cinemachine.CinemachineSplineDolly;
|
using static Unity.Cinemachine.CinemachineSplineDolly;
|
||||||
|
using static UnityEngine.Rendering.DebugUI;
|
||||||
|
|
||||||
public class PlayerCharacterController : MonoBehaviour
|
public class PlayerCharacterController : MonoBehaviour
|
||||||
{
|
{
|
||||||
private CharacterController _cController;
|
private CharacterController _cController;
|
||||||
private Animator _anim;
|
private Animator _anim;
|
||||||
|
|
||||||
private PlayerStateMachine _stateMachine;
|
private PlayerStateMachine _stateMachine;
|
||||||
|
|
||||||
//환경
|
//환경
|
||||||
@@ -44,16 +47,25 @@ public class PlayerCharacterController : MonoBehaviour
|
|||||||
private Vector3 _dodgeDir; // 대쉬 시작 시점의 방향 고정
|
private Vector3 _dodgeDir; // 대쉬 시작 시점의 방향 고정
|
||||||
|
|
||||||
//카메라 전환
|
//카메라 전환
|
||||||
[SerializeField] private AimCameraRig _aimCameraRig; //조준 카메라 집합체
|
|
||||||
private CameraMode _cameraMode = CameraMode.FreeLook; //카메라 모드
|
|
||||||
private CancellationTokenSource _cameraDelayChangeCts; //지연전환 취소 토큰
|
private CancellationTokenSource _cameraDelayChangeCts; //지연전환 취소 토큰
|
||||||
public enum PlayerRotationMode {CameraCoupled, CameraDecoupled}
|
public enum PlayerRotationMode {CameraCoupled, CameraDecoupled}
|
||||||
public PlayerRotationMode RotationMode = PlayerRotationMode.CameraCoupled;
|
public PlayerRotationMode RotationMode = PlayerRotationMode.CameraCoupled;
|
||||||
|
|
||||||
//일단은 기본값
|
//조준모드용 세팅
|
||||||
|
[Header("AimMode Rotation Settings")]
|
||||||
|
private Vector2 _lookInput;
|
||||||
|
private float _lookPitch = 0f;
|
||||||
|
[SerializeField] private float _lookSensitivity = 0.1f;
|
||||||
|
[SerializeField] private float _upperLookLimit = 80f; // 위로 보기 제한
|
||||||
|
[SerializeField] private float _lowerLookLimit = -80f; // 아래로 보기 제한
|
||||||
|
|
||||||
|
|
||||||
|
//게걸음 이동
|
||||||
public bool Strafe = false;
|
public bool Strafe = false;
|
||||||
public void SetStrafeMode(bool b) => Strafe = b;
|
public void SetStrafeMode(bool b) => Strafe = b;
|
||||||
|
|
||||||
|
//조준모드
|
||||||
|
public bool IsAiming => _stateMachine != null && _stateMachine.IsAiming;
|
||||||
|
|
||||||
//캐릭터 관련
|
//캐릭터 관련
|
||||||
public CharacterIdentity PlayerCharacterIdentity { get; set; }
|
public CharacterIdentity PlayerCharacterIdentity { get; set; }
|
||||||
@@ -93,6 +105,7 @@ private void Awake()
|
|||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
_stateMachine.SetMaxJumpCount(_maxJumpCount);
|
_stateMachine.SetMaxJumpCount(_maxJumpCount);
|
||||||
|
SetCursorLockState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
@@ -145,16 +158,11 @@ private void StateUpdate()
|
|||||||
_stateMachine.ChangeState(_stateMachine.IsRunInputPressed ? PlayerState.Run : PlayerState.Walk);
|
_stateMachine.ChangeState(_stateMachine.IsRunInputPressed ? PlayerState.Run : PlayerState.Walk);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"_moveCutTimer : {_moveCutTimer}");
|
|
||||||
|
|
||||||
if (_moveCutTimer > 0)
|
if (_moveCutTimer > 0)
|
||||||
_stateMachine.IsMoveCut = true;
|
_stateMachine.IsMoveCut = true;
|
||||||
else
|
else
|
||||||
_stateMachine.IsMoveCut = false;
|
_stateMachine.IsMoveCut = false;
|
||||||
|
|
||||||
Debug.Log($"_moveCut : {_stateMachine.IsMoveCut}");
|
|
||||||
Debug.Log($"CurentState : {_stateMachine.CurrentState}");
|
|
||||||
|
|
||||||
if (_jumpReadyCoolTimer > 0)
|
if (_jumpReadyCoolTimer > 0)
|
||||||
_stateMachine.IsJumpCool = true;
|
_stateMachine.IsJumpCool = true;
|
||||||
else
|
else
|
||||||
@@ -209,7 +217,7 @@ private void Movement()
|
|||||||
if (normalizedTime >= 1.0f)
|
if (normalizedTime >= 1.0f)
|
||||||
{
|
{
|
||||||
// 구르기 종료 -> 원래상태로 복귀 로직
|
// 구르기 종료 -> 원래상태로 복귀 로직
|
||||||
//_stateMachine.ChangeState(PlayerState.Idle);
|
//StateMachine.ChangeState(PlayerState.Idle);
|
||||||
//_currentSpd = 0f;
|
//_currentSpd = 0f;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -260,8 +268,6 @@ private void Movement()
|
|||||||
//방향키 방향으로 회전하며 이동
|
//방향키 방향으로 회전하며 이동
|
||||||
//RotationByMove();
|
//RotationByMove();
|
||||||
|
|
||||||
Debug.Log($"Forward : {camForward}");
|
|
||||||
|
|
||||||
//모드별 회전
|
//모드별 회전
|
||||||
RotationByMode();
|
RotationByMode();
|
||||||
_anim.SetFloat("DirectX", moveDir.x * _currentSpd / _spdCoefficient);
|
_anim.SetFloat("DirectX", moveDir.x * _currentSpd / _spdCoefficient);
|
||||||
@@ -278,19 +284,40 @@ private void RotationByMove()
|
|||||||
}
|
}
|
||||||
private void RotationByMode()
|
private void RotationByMode()
|
||||||
{
|
{
|
||||||
switch (RotationMode)
|
if (IsAiming) //조준 모드일때는 마우스가 캐릭터 자체를 회전시키고 카메라가 따라간다 (Third Person Follow)
|
||||||
{
|
{
|
||||||
case PlayerRotationMode.CameraCoupled:
|
// 좌우 회전 (Yaw): 캐릭터 본체를 직접 회전시킴
|
||||||
{
|
float yaw = _lookInput.x * _lookSensitivity;
|
||||||
SetStrafeMode(true);
|
transform.Rotate(Vector3.up * yaw);
|
||||||
RecenterPlayer();
|
|
||||||
break;
|
// 상하 회전 (Pitch): 캐릭터는 그대로 두고 내부 변수만 계산
|
||||||
}
|
_lookPitch -= _lookInput.y * _lookSensitivity;
|
||||||
case PlayerRotationMode.CameraDecoupled:
|
_lookPitch = Mathf.Clamp(_lookPitch, _lowerLookLimit, _upperLookLimit);
|
||||||
{
|
|
||||||
SetStrafeMode(false);
|
CinemachineCamera liveCm = GameManager.Instance.Camera.GetLiveCinemachineCamera();
|
||||||
break;
|
|
||||||
}
|
if(liveCm != null)
|
||||||
|
{
|
||||||
|
Transform lookTarget = liveCm.LookAt;
|
||||||
|
lookTarget.localRotation = Quaternion.Euler(_lookPitch, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else //조준 모드가 아니면 회전모드를 따라간다
|
||||||
|
{
|
||||||
|
switch (RotationMode)
|
||||||
|
{
|
||||||
|
case PlayerRotationMode.CameraCoupled:
|
||||||
|
{
|
||||||
|
SetStrafeMode(true);
|
||||||
|
RecenterPlayer();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PlayerRotationMode.CameraDecoupled:
|
||||||
|
{
|
||||||
|
SetStrafeMode(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +342,7 @@ private void OnAnimatorMove()
|
|||||||
{
|
{
|
||||||
// 애니메이션이 가고 싶은 값
|
// 애니메이션이 가고 싶은 값
|
||||||
/*
|
/*
|
||||||
if(_stateMachine.CurrentState == PlayerState.Roll)
|
if(StateMachine.CurrentState == PlayerState.Roll)
|
||||||
{
|
{
|
||||||
_rootMotionVelocity = _anim.deltaPosition / Time.deltaTime;
|
_rootMotionVelocity = _anim.deltaPosition / Time.deltaTime;
|
||||||
}
|
}
|
||||||
@@ -403,5 +430,34 @@ public void DodgeInput(InputState inputState)
|
|||||||
_dodgeTimer = 0f;
|
_dodgeTimer = 0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void AimToggleInput(InputState inputState)
|
||||||
|
{
|
||||||
|
if (inputState == InputState.Started)
|
||||||
|
{
|
||||||
|
if (_stateMachine.IsAiming)
|
||||||
|
{
|
||||||
|
_stateMachine.IsAiming = false;
|
||||||
|
GameManager.Instance.InGameUI.VisibleCrossHair(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_stateMachine.IsAiming = true;
|
||||||
|
GameManager.Instance.InGameUI.VisibleCrossHair(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LookInput(Vector2 lookInput)
|
||||||
|
{
|
||||||
|
_lookInput = lookInput;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 헬퍼
|
||||||
|
public void SetCursorLockState(bool isLocked)
|
||||||
|
{
|
||||||
|
Cursor.lockState = isLocked ? CursorLockMode.Locked : CursorLockMode.None;
|
||||||
|
Cursor.visible = !isLocked;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public class PlayerStateMachine : MonoBehaviour
|
|||||||
public bool IsPossibleCharge { get; set; } //현재 차지 가능한 상태인가
|
public bool IsPossibleCharge { get; set; } //현재 차지 가능한 상태인가
|
||||||
public bool IsMoveCut { get; set; } //현재 이동 금지 상태인가
|
public bool IsMoveCut { get; set; } //현재 이동 금지 상태인가
|
||||||
public bool IsJumpCool { get; set; } //현재 점프 쿨타임 상태인가
|
public bool IsJumpCool { get; set; } //현재 점프 쿨타임 상태인가
|
||||||
|
public bool IsAiming { get; set; } // 현재 aim모드인가
|
||||||
|
|
||||||
private int _jumpCount = 0;
|
private int _jumpCount = 0;
|
||||||
private int _maxJumpCount = 1;
|
private int _maxJumpCount = 1;
|
||||||
|
|||||||
8
Assets/06_UI/Combat.meta
Normal file
8
Assets/06_UI/Combat.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cd82447098a921849ae3b967d26b2773
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/06_UI/Combat/Image.meta
Normal file
8
Assets/06_UI/Combat/Image.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 31854fa0c73fdf64fbab15ae4eeb1866
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/06_UI/Combat/Image/crosshair.png
LFS
Normal file
BIN
Assets/06_UI/Combat/Image/crosshair.png
LFS
Normal file
Binary file not shown.
143
Assets/06_UI/Combat/Image/crosshair.png.meta
Normal file
143
Assets/06_UI/Combat/Image/crosshair.png.meta
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c549791227b0b184588fcb61871da6e3
|
||||||
|
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: 1
|
||||||
|
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
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: Android
|
||||||
|
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: iOS
|
||||||
|
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:
|
||||||
8
Assets/06_UI/Loading/Image.meta
Normal file
8
Assets/06_UI/Loading/Image.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fad7b49424f41f34bbb6d9c78181336e
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/06_UI/Title/Image.meta
Normal file
8
Assets/06_UI/Title/Image.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f919bf899f9a7264387efafe73ff0cc0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user