コード例 #1
0
        public void BuildNavMesh()
        {
            List <NavMeshBuildSource> sources = this.CollectSources();
            Bounds worldBounds;

            ((Bounds) ref worldBounds).\u002Ector(this.m_Center, NavMeshSurface.Abs(this.m_Size));
            if (this.m_CollectObjects == CollectObjects.All || this.m_CollectObjects == CollectObjects.Children)
            {
                worldBounds = this.CalculateWorldBounds(sources);
            }
            NavMeshData navMeshData = NavMeshBuilder.BuildNavMeshData(this.GetBuildSettings(), sources, worldBounds, ((Component)this).get_transform().get_position(), ((Component)this).get_transform().get_rotation());

            if (!Object.op_Inequality((Object)navMeshData, (Object)null))
            {
                return;
            }
            ((Object)navMeshData).set_name(((Object)((Component)this).get_gameObject()).get_name());
            this.RemoveData();
            this.m_NavMeshData = navMeshData;
            if (!((Behaviour)this).get_isActiveAndEnabled())
            {
                return;
            }
            this.AddData();
        }
コード例 #2
0
        private static Bounds GetWorldBounds(Matrix4x4 mat, Bounds bounds)
        {
            Vector3 a      = NavMeshSurface.Abs(mat.MultiplyVector(Vector3.right));
            Vector3 a2     = NavMeshSurface.Abs(mat.MultiplyVector(Vector3.up));
            Vector3 a3     = NavMeshSurface.Abs(mat.MultiplyVector(Vector3.forward));
            Vector3 center = mat.MultiplyPoint(bounds.center);
            Vector3 size   = a * bounds.size.x + a2 * bounds.size.y + a3 * bounds.size.z;

            return(new Bounds(center, size));
        }
コード例 #3
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));
        }
コード例 #4
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();
                }
            }
        }