add more C# look to the PSXPlayer class

This commit is contained in:
aliaksei.kalosha
2025-04-12 01:25:21 +02:00
parent a8e5f7cc4a
commit 09404e6e06

View File

@@ -1,25 +1,28 @@
using UnityEngine; using UnityEngine;
using UnityEngine.AI; using UnityEngine.AI;
using UnityEngine.Serialization;
namespace SplashEdit.RuntimeCode namespace SplashEdit.RuntimeCode
{ {
public class PSXPlayer : MonoBehaviour public class PSXPlayer : MonoBehaviour
{ {
public float PlayerHeight; private const float LookOutDistance = 1000f;
[HideInInspector] [FormerlySerializedAs("PlayerHeight")]
public Vector3 CamPoint; [SerializeField] private float playerHeight;
private readonly float maxDistance = 1000f;
public float PlayerHeight => playerHeight;
public Vector3 CamPoint { get; protected set; }
public void FindNavmesh() public void FindNavmesh()
{ {
NavMeshHit hit; if (NavMesh.SamplePosition(transform.position, out NavMeshHit hit, LookOutDistance, NavMesh.AllAreas))
if (NavMesh.SamplePosition(transform.position, out hit, maxDistance, NavMesh.AllAreas))
{ {
CamPoint = hit.position + new Vector3(0, PlayerHeight, 0); CamPoint = hit.position + new Vector3(0, PlayerHeight, 0);
} }
} }
void OnDrawGizmos() void OnDrawGizmos()
{ {
FindNavmesh(); FindNavmesh();