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