From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001
From: chai <chaifix@163.com>
Date: Wed, 14 Aug 2019 22:50:43 +0800
Subject: +Unity Runtime code

---
 Runtime/NavMesh/NavMeshSettings.h | 69 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100644 Runtime/NavMesh/NavMeshSettings.h

(limited to 'Runtime/NavMesh/NavMeshSettings.h')

diff --git a/Runtime/NavMesh/NavMeshSettings.h b/Runtime/NavMesh/NavMeshSettings.h
new file mode 100644
index 0000000..6c1b6ca
--- /dev/null
+++ b/Runtime/NavMesh/NavMeshSettings.h
@@ -0,0 +1,69 @@
+#pragma once
+
+#include "Runtime/BaseClasses/GameManager.h"
+#include "Runtime/Utilities/dynamic_array.h"
+#include "Runtime/NavMesh/NavMeshTypes.h"
+#if UNITY_EDITOR
+#include "Editor/Src/NavMesh/NavMeshBuildSettings.h"
+#endif
+
+class NavMesh;
+class dtNavMesh;
+
+class NavMeshSettings : public LevelGameManager
+{
+public:
+
+	REGISTER_DERIVED_CLASS (NavMeshSettings, LevelGameManager);
+	DECLARE_OBJECT_SERIALIZE (NavMeshSettings);
+
+	NavMeshSettings (MemLabelId& label, ObjectCreationMode mode);
+
+	virtual void		AwakeFromLoad (AwakeFromLoadMode mode);
+	virtual void		Reset ();
+
+	inline void			SetNavMesh (NavMesh* navMesh);
+	inline NavMesh*		GetNavMesh ();
+
+	bool				SetOffMeshPolyInstanceID (dtPolyRef ref, int instanceID);
+	void                SetOffMeshPolyCostOverride (dtPolyRef ref, float costOverride);
+	void				SetOffMeshPolyAccess (dtPolyRef ref, bool access);
+
+
+	#if UNITY_EDITOR
+	inline NavMeshBuildSettings& GetNavMeshBuildSettings ();
+	#endif
+
+	static void InitializeClass ();
+	static void CleanupClass ();
+
+	dtNavMesh* GetInternalNavMesh ();
+private:
+
+#if UNITY_EDITOR
+	NavMeshBuildSettings m_BuildSettings;
+#endif
+
+	PPtr<NavMesh> m_NavMesh;
+};
+
+inline void NavMeshSettings::SetNavMesh (NavMesh* navMesh)
+{
+	m_NavMesh = navMesh;
+	SetDirty ();
+}
+
+inline NavMesh* NavMeshSettings::GetNavMesh ()
+{
+	return m_NavMesh;
+}
+
+#if UNITY_EDITOR
+inline NavMeshBuildSettings& NavMeshSettings::GetNavMeshBuildSettings ()
+{
+	return m_BuildSettings;
+}
+#endif
+
+NavMeshSettings& GetNavMeshSettings ();
+
-- 
cgit v1.1-26-g67d0