remove obstacle
This commit is contained in:
@@ -6,7 +6,7 @@ namespace OnlyScove.Scripts
|
||||
public class PlayerDebugProvider : MonoBehaviour
|
||||
{
|
||||
[Header("References")]
|
||||
[SerializeField] private PlayerStateMachine stateMachine;
|
||||
// [SerializeField] private PlayerStateMachine stateMachine;
|
||||
[Tooltip("Kéo cái Canvas (World Space) bạn đã thiết kế vào đây")]
|
||||
[SerializeField] private GameObject debugCanvas;
|
||||
|
||||
@@ -16,36 +16,36 @@ namespace OnlyScove.Scripts
|
||||
[SerializeField] private bool lookAtCamera = true;
|
||||
|
||||
// Các thuộc tính Public để bạn truy cập từ Script UI của bạn
|
||||
public string CurrentState => stateMachine != null ? stateMachine.CurrentStateName : "N/A";
|
||||
public string GroundedStatus => (stateMachine != null && stateMachine.IsGrounded) ? "YES" : "NO";
|
||||
public float HorizontalSpeed => stateMachine != null ? new Vector3(stateMachine.Controller.velocity.x, 0, stateMachine.Controller.velocity.z).magnitude : 0f;
|
||||
public float VerticalSpeed => stateMachine != null ? stateMachine.VelocityY : 0f;
|
||||
// public string CurrentState => stateMachine != null ? stateMachine.CurrentStateName : "N/A";
|
||||
// public string GroundedStatus => (stateMachine != null && stateMachine.IsGrounded) ? "YES" : "NO";
|
||||
// public float HorizontalSpeed => stateMachine != null ? new Vector3(stateMachine.Controller.velocity.x, 0, stateMachine.Controller.velocity.z).magnitude : 0f;
|
||||
// public float VerticalSpeed => stateMachine != null ? stateMachine.VelocityY : 0f;
|
||||
//
|
||||
// // Sửa lỗi truy cập InputReader từ StateMachine
|
||||
// public Vector2 MoveInput => (stateMachine != null && stateMachine.Input != null) ? stateMachine.Input.MoveInput : Vector2.zero;
|
||||
// public bool IsSprinting => (stateMachine != null && stateMachine.Input != null) ? stateMachine.Input.IsSprintHeld : false;
|
||||
//
|
||||
// public string TargetInteractable => stateMachine != null ? (stateMachine.GetInteractable()?.InteractionPrompt ?? "None") : "N/A";
|
||||
//
|
||||
// public IInteractable GetActiveInteractable() => stateMachine?.GetInteractable();
|
||||
|
||||
// Sửa lỗi truy cập InputReader từ StateMachine
|
||||
public Vector2 MoveInput => (stateMachine != null && stateMachine.Input != null) ? stateMachine.Input.MoveInput : Vector2.zero;
|
||||
public bool IsSprinting => (stateMachine != null && stateMachine.Input != null) ? stateMachine.Input.IsSprintHeld : false;
|
||||
|
||||
public string TargetInteractable => stateMachine != null ? (stateMachine.GetInteractable()?.InteractionPrompt ?? "None") : "N/A";
|
||||
|
||||
public IInteractable GetActiveInteractable() => stateMachine?.GetInteractable();
|
||||
|
||||
public Vector3 GetInteractionPoint()
|
||||
{
|
||||
if (stateMachine == null || stateMachine.Scanner == null) return Vector3.zero;
|
||||
return stateMachine.Scanner.GetLastInteractionPoint(stateMachine.InteractionRange, stateMachine.InteractionMask);
|
||||
}
|
||||
// public Vector3 GetInteractionPoint()
|
||||
// {
|
||||
// if (stateMachine == null || stateMachine.Scanner == null) return Vector3.zero;
|
||||
// return stateMachine.Scanner.GetLastInteractionPoint(stateMachine.InteractionRange, stateMachine.InteractionMask);
|
||||
// }
|
||||
|
||||
private Vector3 currentVelocity;
|
||||
private Transform cameraTransform;
|
||||
private bool isVisible = true;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (stateMachine == null) stateMachine = GetComponent<PlayerStateMachine>();
|
||||
cameraTransform = Camera.main?.transform;
|
||||
|
||||
if (debugCanvas != null) debugCanvas.SetActive(isVisible);
|
||||
}
|
||||
// private void Awake()
|
||||
// {
|
||||
// if (stateMachine == null) stateMachine = GetComponent<PlayerStateMachine>();
|
||||
// cameraTransform = Camera.main?.transform;
|
||||
//
|
||||
// if (debugCanvas != null) debugCanvas.SetActive(isVisible);
|
||||
// }
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user