static public int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         UnityEngine.AI.NavMeshData o;
         if (argc == 1)
         {
             o = new UnityEngine.AI.NavMeshData();
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 2)
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             o = new UnityEngine.AI.NavMeshData(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #2
0
 private void OnEnable()
 {
     this.agentTypeId  = NavMesh.GetSettingsByIndex(this.NavMeshAgentTypeIndex).agentTypeID;
     this.NavMeshData  = new UnityEngine.AI.NavMeshData(this.agentTypeId);
     this.sources      = new List <NavMeshBuildSource>();
     this.terrainBakes = new List <AsyncTerrainNavMeshBake>();
     this.defaultArea  = NavMesh.GetAreaFromName(this.DefaultAreaName);
     base.InvokeRepeating(new Action(this.FinishBuildingNavmesh), 0f, 1f);
 }
Пример #3
0
 public static NavMeshDataInstance AddNavMeshData(NavMeshData navMeshData)
 {
     if (navMeshData == null)
     {
         throw new ArgumentNullException("navMeshData");
     }
     return(new NavMeshDataInstance
     {
         id = NavMesh.AddNavMeshDataInternal(navMeshData)
     });
 }
Пример #4
0
        public AsyncOperation UpdateNavMesh(NavMeshData data)
        {
            List <NavMeshBuildSource> sources = this.CollectSources();
            Bounds localBounds = new Bounds(this.m_Center, NavMeshSurface.Abs(this.m_Size));

            if (this.m_CollectObjects == CollectObjects.All || this.m_CollectObjects == CollectObjects.Children)
            {
                localBounds = this.CalculateWorldBounds(sources);
            }
            return(NavMeshBuilder.UpdateNavMeshDataAsync(data, this.GetBuildSettings(), sources, localBounds));
        }
Пример #5
0
        public static NavMeshDataInstance AddNavMeshData(NavMeshData navMeshData, Vector3 position, Quaternion rotation)
        {
            if (navMeshData == null)
            {
                throw new ArgumentNullException("navMeshData");
            }
            NavMeshDataInstance result = default(NavMeshDataInstance);

            result.id = AddNavMeshDataTransformedInternal(navMeshData, position, rotation);
            return(result);
        }
Пример #6
0
 public static NavMeshDataInstance AddNavMeshData(NavMeshData navMeshData, Vector3 position, Quaternion rotation)
 {
     if (navMeshData == null)
     {
         throw new ArgumentNullException("navMeshData");
     }
     return(new NavMeshDataInstance
     {
         id = NavMesh.AddNavMeshDataTransformedInternal(navMeshData, position, rotation)
     });
 }
Пример #7
0
        public static NavMeshDataInstance AddNavMeshData(NavMeshData navMeshData)
        {
            if (navMeshData == null)
            {
                throw new ArgumentNullException("navMeshData");
            }
            NavMeshDataInstance result = default(NavMeshDataInstance);

            result.id = AddNavMeshDataInternal(navMeshData);
            return(result);
        }
Пример #8
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public static NavMeshDataInstance AddNavMeshData(NavMeshData navMeshData)
        {
            if (navMeshData == null)
            {
                throw new ArgumentNullException("navMeshData");
            }

            var handle = new NavMeshDataInstance();

            handle.id = AddNavMeshDataInternal(navMeshData);
            return(handle);
        }
 static public int get_sourceBounds(IntPtr l)
 {
     try {
         UnityEngine.AI.NavMeshData self = (UnityEngine.AI.NavMeshData)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.sourceBounds);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #10
0
 private static bool UpdateNavMeshData(NavMeshData data, NavMeshBuildSettings buildSettings, List <NavMeshBuildSource> sources, Bounds localBounds, NavMeshBuildDebugSettings debug)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     if (sources == null)
     {
         throw new ArgumentNullException("sources");
     }
     return(UpdateNavMeshDataListInternal(data, buildSettings, sources, localBounds, debug));
 }
Пример #11
0
        public static NavMeshDataInstance AddNavMeshData(NavMeshData navMeshData, Vector3 position, Quaternion rotation)
        {
            if (navMeshData == null)
            {
                throw new ArgumentNullException("navMeshData");
            }

            var handle = new NavMeshDataInstance();

            handle.id = AddNavMeshDataTransformedInternal(navMeshData, position, rotation);
            return(handle);
        }
Пример #12
0
 public static AsyncOperation UpdateNavMeshDataAsync(NavMeshData data, NavMeshBuildSettings buildSettings, List <NavMeshBuildSource> sources, Bounds localBounds)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     if (sources == null)
     {
         throw new ArgumentNullException("sources");
     }
     return(NavMeshBuilder.UpdateNavMeshDataAsyncListInternal(data, buildSettings, sources, localBounds));
 }
Пример #13
0
 public static bool UpdateNavMeshData(NavMeshData data, NavMeshBuildSettings buildSettings, List <NavMeshBuildSource> sources, Bounds localBounds)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     if (sources == null)
     {
         throw new ArgumentNullException("sources");
     }
     return(UpdateNavMeshData(data, buildSettings, sources, localBounds, default(NavMeshBuildDebugSettings)));
 }
Пример #14
0
        public static NavMeshData BuildNavMeshData(NavMeshBuildSettings buildSettings, List <NavMeshBuildSource> sources, Bounds localBounds, Vector3 position, Quaternion rotation)
        {
            if (sources == null)
            {
                throw new ArgumentNullException("sources");
            }
            NavMeshData navMeshData = new NavMeshData(buildSettings.agentTypeID);

            navMeshData.position = position;
            navMeshData.rotation = rotation;
            NavMeshBuilder.UpdateNavMeshDataListInternal(navMeshData, buildSettings, sources, localBounds);
            return(navMeshData);
        }
        // Immediate NavMeshData updating
        public static bool UpdateNavMeshData(
            NavMeshData data, NavMeshBuildSettings buildSettings, List <NavMeshBuildSource> sources, Bounds localBounds)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (sources == null)
            {
                throw new ArgumentNullException(nameof(sources));
            }

            return(UpdateNavMeshDataListInternal(data, buildSettings, sources, localBounds));
        }
Пример #16
0
 static public int set_rotation(IntPtr l)
 {
     try {
         UnityEngine.AI.NavMeshData self = (UnityEngine.AI.NavMeshData)checkSelf(l);
         UnityEngine.Quaternion     v;
         checkType(l, 2, out v);
         self.rotation = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #17
0
        public AsyncOperation UpdateNavMesh(NavMeshData data)
        {
            var sources = CollectSources();
            // Use unscaled bounds - this differs in behaviour from e.g. collider components.
            // But is similar to reflection probe - and since navmesh data has no scaling support - it is the right choice here.
            var sourcesBounds = new Bounds(m_Center, Abs(m_Size));

            if (m_CollectObjects == CollectObjects.All || m_CollectObjects == CollectObjects.Children)
            {
                sourcesBounds = CalculateWorldBounds(sources);
            }

            return(NavMeshBuilder.UpdateNavMeshDataAsync(data, GetBuildSettings(), sources, sourcesBounds));
        }
Пример #18
0
        void OnValidate()
        {
            if (UnshareNavMeshAsset())
            {
                Debug.LogWarning("Duplicating NavMeshSurface does not duplicate the referenced navmesh data", this);
                m_NavMeshData = null;
            }

            var settings = NavMesh.GetSettingsByID(m_AgentTypeID);

            if (settings.agentTypeID != -1)
            {
                // When unchecking the override control, revert to automatic value.
                const float kMinVoxelSize = 0.01f;
                if (!m_OverrideVoxelSize)
                {
                    m_VoxelSize = settings.agentRadius / 3.0f;
                }
                if (m_VoxelSize < kMinVoxelSize)
                {
                    m_VoxelSize = kMinVoxelSize;
                }

                // When unchecking the override control, revert to default value.
                const int kMinTileSize     = 16;
                const int kMaxTileSize     = 1024;
                const int kDefaultTileSize = 256;

                if (!m_OverrideTileSize)
                {
                    m_TileSize = kDefaultTileSize;
                }
                // Make sure tilesize is in sane range.
                if (m_TileSize < kMinTileSize)
                {
                    m_TileSize = kMinTileSize;
                }
                if (m_TileSize > kMaxTileSize)
                {
                    m_TileSize = kMaxTileSize;
                }

                const float kMinimumMinRegionArea = 0;
                if (m_MinRegionArea < kMinimumMinRegionArea)
                {
                    m_MinRegionArea = kMinimumMinRegionArea;
                }
            }
        }
        public static bool UpdateNavMeshData(NavMeshData data, NavMeshBuildSettings buildSettings, List <NavMeshBuildSource> sources, Bounds localBounds)
        {
            bool flag = data == null;

            if (flag)
            {
                throw new ArgumentNullException("data");
            }
            bool flag2 = sources == null;

            if (flag2)
            {
                throw new ArgumentNullException("sources");
            }
            return(NavMeshBuilder.UpdateNavMeshDataListInternal(data, buildSettings, sources, localBounds));
        }
        void OnEnable()
        {
            Register(this);

            // Workaround: Make sure we have unique navmesh data, if not, delete reference to the data.
            // HasUniqueNavMeshData () assumes that the original copy got registered before us.
            if (!HasUniqueNavMeshData())
            {
                if (m_BakedNavMeshData != null)
                {
                    Debug.LogWarning("Duplicating NavMeshSurface does not duplicate the referenced navmesh data");
                    m_BakedNavMeshData = null;
                }
            }

            AddData();
        }
Пример #21
0
        // Source: https://github.com/Unity-Technologies/NavMeshComponents/issues/97#issuecomment-528692289
        public AsyncOperation BuildNavMeshAsync()
        {
            RemoveData();
            m_NavMeshData = new NavMeshData(m_AgentTypeID)
            {
                name     = gameObject.name,
                position = transform.position,
                rotation = transform.rotation
            };

            if (isActiveAndEnabled)
            {
                AddData();
            }

            return(UpdateNavMesh(m_NavMeshData));
        }
        // Immediate NavMeshData building
        public static NavMeshData BuildNavMeshData(
            NavMeshBuildSettings buildSettings, List <NavMeshBuildSource> sources,
            Bounds localBounds, Vector3 position, Quaternion rotation)
        {
            if (sources == null)
            {
                throw new ArgumentNullException(nameof(sources));
            }

            var data = new NavMeshData(buildSettings.agentTypeID)
            {
                position = position,
                rotation = rotation
            };

            UpdateNavMeshDataListInternal(data, buildSettings, sources, localBounds);
            return(data);
        }
Пример #23
0
        public void BuildNavMesh()

        {
            var sources = CollectSources();



            // Use unscaled bounds - this differs in behaviour from e.g. collider components.

            // But is similar to reflection probe - and since navmesh data has no scaling support - it is the right choice here.

            var sourcesBounds = new Bounds(m_Center, Abs(m_Size));

            if (m_CollectObjects == CollectObjects.All || m_CollectObjects == CollectObjects.Children)

            {
                sourcesBounds = CalculateWorldBounds(sources);
            }



            var data = NavMeshBuilder.BuildNavMeshData(GetBuildSettings(),

                                                       sources, sourcesBounds, transform.position, transform.rotation);



            if (data != null)

            {
                data.name = gameObject.name;

                RemoveData();

                m_NavMeshData = data;

                if (isActiveAndEnabled)
                {
                    AddData();
                }
            }
        }
Пример #24
0
        public void BuildNavMesh()
        {
            List <NavMeshBuildSource> sources = this.CollectSources();
            Bounds localBounds = new Bounds(this.m_Center, NavMeshSurface.Abs(this.m_Size));

            if (this.m_CollectObjects == CollectObjects.All || this.m_CollectObjects == CollectObjects.Children)
            {
                localBounds = this.CalculateWorldBounds(sources);
            }
            NavMeshData navMeshData = NavMeshBuilder.BuildNavMeshData(this.GetBuildSettings(), sources, localBounds, base.transform.position, base.transform.rotation);

            if (navMeshData != null)
            {
                navMeshData.name = base.gameObject.name;
                this.RemoveData();
                this.m_NavMeshData = navMeshData;
                if (base.isActiveAndEnabled)
                {
                    this.AddData();
                }
            }
        }
Пример #25
0
 private static extern void Internal_Create([Writable] NavMeshData mono, int agentTypeID);
Пример #26
0
 public NavMeshData(int agentTypeID)
 {
     NavMeshData.Internal_Create(this, agentTypeID);
 }
Пример #27
0
 public NavMeshData()
 {
     NavMeshData.Internal_Create(this, 0);
 }
Пример #28
0
 private static extern bool INTERNAL_CALL_UpdateNavMeshDataListInternal(NavMeshData data, ref NavMeshBuildSettings buildSettings, object sources, ref Bounds localBounds);
Пример #29
0
 private static bool UpdateNavMeshDataListInternal(NavMeshData data, NavMeshBuildSettings buildSettings, object sources, Bounds localBounds)
 {
     return(NavMeshBuilder.INTERNAL_CALL_UpdateNavMeshDataListInternal(data, ref buildSettings, sources, ref localBounds));
 }
Пример #30
0
 public static extern void Cancel(NavMeshData data);