/*
* author: ryan lin
* date: 8/8/2024
* description: TODO
*/
using UnityEngine;
///
/// TODO
///
public class Player : MonoBehaviour
{
///
/// TODO
///
[SerializeField] private Transform playerPosition;
///
/// TODO
///
[SerializeField] private float seeDistance;
///
/// TODO
///
public LayerMask raycastLayers;
///
/// TODO
///
private bool _active;
///
/// TODO
///
private CommonInteractable _currentInteractable;
///
/// TODO
///
private bool _raycast;
///
/// TODO
///
public RaycastHit Hit;
///
/// TODO
///
private void Update()
{
_raycast = Physics.Raycast(
playerPosition.position,
playerPosition.TransformDirection(Vector3.forward),
out Hit,
seeDistance,
raycastLayers
);
Debug.DrawRay(
playerPosition.position,
playerPosition.TransformDirection(Vector3.forward) * seeDistance,
Color.green
);
}
///
/// TODO
///
private void OnAction()
{
Debug.Log("test");
if (_raycast)
if (Hit.transform.CompareTag("Interactable"))
Hit.transform.GetComponent().Interact();
}
}