add more C# look to the PSXPlayer class
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user