summaryrefslogtreecommitdiff
path: root/Runtime/NavMesh/NavMeshLayers.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/NavMesh/NavMeshLayers.h
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/NavMesh/NavMeshLayers.h')
-rw-r--r--Runtime/NavMesh/NavMeshLayers.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/Runtime/NavMesh/NavMeshLayers.h b/Runtime/NavMesh/NavMeshLayers.h
new file mode 100644
index 0000000..0c4085f
--- /dev/null
+++ b/Runtime/NavMesh/NavMeshLayers.h
@@ -0,0 +1,63 @@
+#ifndef NAVMESH_LAYERS_H
+#define NAVMESH_LAYERS_H
+
+#include "Runtime/BaseClasses/GameManager.h"
+
+
+
+
+class NavMeshLayers : public GlobalGameManager
+{
+public:
+ struct NavMeshLayerData
+ {
+ DECLARE_SERIALIZE (NavMeshLayerData)
+ enum
+ {
+ kEditNone = 0,
+ kEditName = 1,
+ kEditCost = 2
+ };
+
+ UnityStr name;
+ float cost;
+ int editType;
+ };
+
+ enum BuiltinNavMeshLayers
+ {
+ kDefaultLayer = 0,
+ kNotWalkable = 1,
+ kJumpLayer = 2
+ };
+
+ NavMeshLayers (MemLabelId& label, ObjectCreationMode mode);
+ // ~NavMeshLayers (); declared-by-macro
+
+ REGISTER_DERIVED_CLASS (NavMeshLayers, GlobalGameManager)
+ DECLARE_OBJECT_SERIALIZE (NavMeshLayers)
+
+ virtual void Reset ();
+ virtual void AwakeFromLoad (AwakeFromLoadMode awakeMode);
+ virtual void CheckConsistency ();
+
+ void SetLayerCost (unsigned int index, float cost);
+ float GetLayerCost (unsigned int index) const;
+ int GetNavMeshLayerFromName (const UnityStr& layerName) const;
+ std::vector<std::string> NavMeshLayerNames () const;
+
+ enum
+ {
+ kBuiltinLayerCount = 3,
+ kLayerCount = 32
+ };
+
+ static const char* s_WarningCostLessThanOne;
+private:
+
+ NavMeshLayerData m_Layers[kLayerCount];
+};
+
+NavMeshLayers& GetNavMeshLayers ();
+
+#endif