From 09404e6e06e3832ab4b3165646d85125a3f9b007 Mon Sep 17 00:00:00 2001 From: "aliaksei.kalosha" Date: Sat, 12 Apr 2025 01:25:21 +0200 Subject: [PATCH] add more C# look to the PSXPlayer class --- Runtime/PSXPlayer.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Runtime/PSXPlayer.cs b/Runtime/PSXPlayer.cs index bcacaa3..8d5d4ad 100644 --- a/Runtime/PSXPlayer.cs +++ b/Runtime/PSXPlayer.cs @@ -1,25 +1,28 @@ using UnityEngine; using UnityEngine.AI; +using UnityEngine.Serialization; namespace SplashEdit.RuntimeCode { public class PSXPlayer : MonoBehaviour { - public float PlayerHeight; + private const float LookOutDistance = 1000f; - [HideInInspector] - public Vector3 CamPoint; - private readonly float maxDistance = 1000f; + [FormerlySerializedAs("PlayerHeight")] + [SerializeField] private float playerHeight; + + public float PlayerHeight => playerHeight; + public Vector3 CamPoint { get; protected set; } public void FindNavmesh() { - NavMeshHit hit; - if (NavMesh.SamplePosition(transform.position, out hit, maxDistance, NavMesh.AllAreas)) + if (NavMesh.SamplePosition(transform.position, out NavMeshHit hit, LookOutDistance, NavMesh.AllAreas)) { CamPoint = hit.position + new Vector3(0, PlayerHeight, 0); } } + void OnDrawGizmos() { FindNavmesh();