예제 #1
0
        internal static void DeserializeReferences(GraphSerializationContext ctx)
        {
            int count = ctx.reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                var linkID         = ctx.reader.ReadUInt64();
                var startNode      = ctx.DeserializeNodeReference();
                var endNode        = ctx.DeserializeNodeReference();
                var connectedNode1 = ctx.DeserializeNodeReference();
                var connectedNode2 = ctx.DeserializeNodeReference();
                var clamped1       = ctx.DeserializeVector3();
                var clamped2       = ctx.DeserializeVector3();
                var postScanCalled = ctx.reader.ReadBoolean();

                GraphModifier link;
                if (usedIDs.TryGetValue(linkID, out link))
                {
                    var link2 = link as NodeLink2;
                    if (link2 != null)
                    {
                        if (startNode != null)
                        {
                            reference[startNode] = link2;
                        }
                        if (endNode != null)
                        {
                            reference[endNode] = link2;
                        }

                        // If any nodes happened to be registered right now
                        if (link2.startNode != null)
                        {
                            reference.Remove(link2.startNode);
                        }
                        if (link2.endNode != null)
                        {
                            reference.Remove(link2.endNode);
                        }

                        link2.startNode      = startNode as PointNode;
                        link2.endNode        = endNode as PointNode;
                        link2.connectedNode1 = connectedNode1;
                        link2.connectedNode2 = connectedNode2;
                        link2.postScanCalled = postScanCalled;
                        link2.clamped1       = clamped1;
                        link2.clamped2       = clamped2;
                    }
                    else
                    {
                        throw new System.Exception("Tried to deserialize a NodeLink2 reference, but the link was not of the correct type or it has been destroyed.\nIf a NodeLink2 is included in serialized graph data, the same NodeLink2 component must be present in the scene when loading the graph data.");
                    }
                }
                else
                {
                    throw new System.Exception("Tried to deserialize a NodeLink2 reference, but the link could not be found in the scene.\nIf a NodeLink2 is included in serialized graph data, the same NodeLink2 component must be present in the scene when loading the graph data.");
                }
            }
        }
예제 #2
0
 public override void DeserializeSettings(GraphSerializationContext ctx)
 {
     base.DeserializeSettings(ctx);
     this.sourceMesh = (ctx.DeserializeUnityObject() as Mesh);
     this.offset = ctx.DeserializeVector3();
     this.rotation = ctx.DeserializeVector3();
     this.scale = ctx.reader.ReadSingle();
     this.accurateNearestNode = ctx.reader.ReadBoolean();
 }
예제 #3
0
 public override void DeserializeSettingsCompatibility(GraphSerializationContext ctx)
 {
     base.DeserializeSettingsCompatibility(ctx);
     this.sourceMesh          = (ctx.DeserializeUnityObject() as Mesh);
     this.offset              = ctx.DeserializeVector3();
     this.rotation            = ctx.DeserializeVector3();
     this.scale               = ctx.reader.ReadSingle();
     this.nearestSearchOnlyXZ = !ctx.reader.ReadBoolean();
 }
예제 #4
0
        public override void DeserializeSettingsCompatibility(GraphSerializationContext ctx)
        {
            base.DeserializeSettingsCompatibility(ctx);

            sourceMesh = ctx.DeserializeUnityObject() as Mesh;

            offset              = ctx.DeserializeVector3();
            rotation            = ctx.DeserializeVector3();
            scale               = ctx.reader.ReadSingle();
            accurateNearestNode = ctx.reader.ReadBoolean();
        }
예제 #5
0
        // Token: 0x060022EB RID: 8939 RVA: 0x001924B8 File Offset: 0x001906B8
        internal static void DeserializeReferences(GraphSerializationContext ctx)
        {
            int num = ctx.reader.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                ulong         key        = ctx.reader.ReadUInt64();
                GraphNode     graphNode  = ctx.DeserializeNodeReference();
                GraphNode     graphNode2 = ctx.DeserializeNodeReference();
                GraphNode     graphNode3 = ctx.DeserializeNodeReference();
                GraphNode     graphNode4 = ctx.DeserializeNodeReference();
                Vector3       vector     = ctx.DeserializeVector3();
                Vector3       vector2    = ctx.DeserializeVector3();
                bool          flag       = ctx.reader.ReadBoolean();
                GraphModifier graphModifier;
                if (!GraphModifier.usedIDs.TryGetValue(key, out graphModifier))
                {
                    throw new Exception("Tried to deserialize a NodeLink2 reference, but the link could not be found in the scene.\nIf a NodeLink2 is included in serialized graph data, the same NodeLink2 component must be present in the scene when loading the graph data.");
                }
                NodeLink2 nodeLink = graphModifier as NodeLink2;
                if (!(nodeLink != null))
                {
                    throw new Exception("Tried to deserialize a NodeLink2 reference, but the link was not of the correct type or it has been destroyed.\nIf a NodeLink2 is included in serialized graph data, the same NodeLink2 component must be present in the scene when loading the graph data.");
                }
                if (graphNode != null)
                {
                    NodeLink2.reference[graphNode] = nodeLink;
                }
                if (graphNode2 != null)
                {
                    NodeLink2.reference[graphNode2] = nodeLink;
                }
                if (nodeLink.startNode != null)
                {
                    NodeLink2.reference.Remove(nodeLink.startNode);
                }
                if (nodeLink.endNode != null)
                {
                    NodeLink2.reference.Remove(nodeLink.endNode);
                }
                nodeLink.startNode      = (graphNode as PointNode);
                nodeLink.endNode        = (graphNode2 as PointNode);
                nodeLink.connectedNode1 = graphNode3;
                nodeLink.connectedNode2 = graphNode4;
                nodeLink.postScanCalled = flag;
                nodeLink.clamped1       = vector;
                nodeLink.clamped2       = vector2;
            }
        }
예제 #6
0
        protected override void DeserializeSettingsCompatibility(GraphSerializationContext ctx)
        {
            base.DeserializeSettingsCompatibility(ctx);

            characterRadius = ctx.reader.ReadSingle();
            contourMaxError = ctx.reader.ReadSingle();
            cellSize        = ctx.reader.ReadSingle();
            ctx.reader.ReadSingle();             // Backwards compatibility, cellHeight was previously read here
            walkableHeight           = ctx.reader.ReadSingle();
            maxSlope                 = ctx.reader.ReadSingle();
            maxEdgeLength            = ctx.reader.ReadSingle();
            editorTileSize           = ctx.reader.ReadInt32();
            tileSizeX                = ctx.reader.ReadInt32();
            nearestSearchOnlyXZ      = ctx.reader.ReadBoolean();
            useTiles                 = ctx.reader.ReadBoolean();
            relevantGraphSurfaceMode = (RelevantGraphSurfaceMode)ctx.reader.ReadInt32();
            rasterizeColliders       = ctx.reader.ReadBoolean();
            rasterizeMeshes          = ctx.reader.ReadBoolean();
            rasterizeTerrain         = ctx.reader.ReadBoolean();
            rasterizeTrees           = ctx.reader.ReadBoolean();
            colliderRasterizeDetail  = ctx.reader.ReadSingle();
            forcedBoundsCenter       = ctx.DeserializeVector3();
            forcedBoundsSize         = ctx.DeserializeVector3();
            mask = ctx.reader.ReadInt32();

            int count = ctx.reader.ReadInt32();

            tagMask = new List <string>(count);
            for (int i = 0; i < count; i++)
            {
                tagMask.Add(ctx.reader.ReadString());
            }

            showMeshOutline     = ctx.reader.ReadBoolean();
            showNodeConnections = ctx.reader.ReadBoolean();
            terrainSampleSize   = ctx.reader.ReadInt32();

            // These were originally forgotten but added in an upgrade
            // To keep backwards compatibility, they are only deserialized
            // If they exist in the streamed data
            walkableClimb = ctx.DeserializeFloat(walkableClimb);
            minRegionSize = ctx.DeserializeFloat(minRegionSize);

            // Make the world square if this value is not in the stream
            tileSizeZ = ctx.DeserializeInt(tileSizeX);

            showMeshSurface = ctx.reader.ReadBoolean();
        }
예제 #7
0
        public override void DeserializeExtraInfo(GraphSerializationContext ctx)
        {
            TriangleMeshNode.SetNavmeshHolder((int)ctx.graphIndex, this);
            int num2 = ctx.reader.ReadInt32();
            int num3 = ctx.reader.ReadInt32();

            if (num2 == -1)
            {
                this.nodes            = new TriangleMeshNode[0];
                this._vertices        = new Int3[0];
                this.originalVertices = new Vector3[0];
            }
            this.nodes            = new TriangleMeshNode[num2];
            this._vertices        = new Int3[num3];
            this.originalVertices = new Vector3[num3];
            for (int i = 0; i < num3; i++)
            {
                this._vertices[i]        = ctx.DeserializeInt3();
                this.originalVertices[i] = ctx.DeserializeVector3();
            }
            this.bbTree = new BBTree();
            for (int j = 0; j < num2; j++)
            {
                this.nodes[j] = new TriangleMeshNode(base.active);
                TriangleMeshNode node = this.nodes[j];
                node.DeserializeNode(ctx);
                node.UpdatePositionFromVertices();
            }
            this.bbTree.RebuildFrom(this.nodes);
        }
예제 #8
0
        public override void DeserializeSettingsCompatibility(GraphSerializationContext ctx)
        {
            base.DeserializeSettingsCompatibility(ctx);
            this.characterRadius = ctx.reader.ReadSingle();
            this.contourMaxError = ctx.reader.ReadSingle();
            this.cellSize        = ctx.reader.ReadSingle();
            ctx.reader.ReadSingle();
            this.walkableHeight           = ctx.reader.ReadSingle();
            this.maxSlope                 = ctx.reader.ReadSingle();
            this.maxEdgeLength            = ctx.reader.ReadSingle();
            this.editorTileSize           = ctx.reader.ReadInt32();
            this.tileSizeX                = ctx.reader.ReadInt32();
            this.nearestSearchOnlyXZ      = ctx.reader.ReadBoolean();
            this.useTiles                 = ctx.reader.ReadBoolean();
            this.relevantGraphSurfaceMode = (RecastGraph.RelevantGraphSurfaceMode)ctx.reader.ReadInt32();
            this.rasterizeColliders       = ctx.reader.ReadBoolean();
            this.rasterizeMeshes          = ctx.reader.ReadBoolean();
            this.rasterizeTerrain         = ctx.reader.ReadBoolean();
            this.rasterizeTrees           = ctx.reader.ReadBoolean();
            this.colliderRasterizeDetail  = ctx.reader.ReadSingle();
            this.forcedBoundsCenter       = ctx.DeserializeVector3();
            this.forcedBoundsSize         = ctx.DeserializeVector3();
            this.mask = ctx.reader.ReadInt32();
            int num = ctx.reader.ReadInt32();

            this.tagMask = new List <string>(num);
            for (int i = 0; i < num; i++)
            {
                this.tagMask.Add(ctx.reader.ReadString());
            }
            this.showMeshOutline     = ctx.reader.ReadBoolean();
            this.showNodeConnections = ctx.reader.ReadBoolean();
            this.terrainSampleSize   = ctx.reader.ReadInt32();
            this.walkableClimb       = ctx.DeserializeFloat(this.walkableClimb);
            this.minRegionSize       = ctx.DeserializeFloat(this.minRegionSize);
            this.tileSizeZ           = ctx.DeserializeInt(this.tileSizeX);
            this.showMeshSurface     = ctx.reader.ReadBoolean();
        }
예제 #9
0
        public override void DeserializeSettingsCompatibility(GraphSerializationContext ctx)
        {
            base.DeserializeSettingsCompatibility(ctx);

            root               = ctx.DeserializeUnityObject() as Transform;
            searchTag          = ctx.reader.ReadString();
            maxDistance        = ctx.reader.ReadSingle();
            limits             = ctx.DeserializeVector3();
            raycast            = ctx.reader.ReadBoolean();
            use2DPhysics       = ctx.reader.ReadBoolean();
            thickRaycast       = ctx.reader.ReadBoolean();
            thickRaycastRadius = ctx.reader.ReadSingle();
            recursive          = ctx.reader.ReadBoolean();
            ctx.reader.ReadBoolean();             // Deprecated field
            mask = (LayerMask)ctx.reader.ReadInt32();
        }
예제 #10
0
 public override void DeserializeSettingsCompatibility(GraphSerializationContext ctx)
 {
     base.DeserializeSettingsCompatibility(ctx);
     this.root               = (ctx.DeserializeUnityObject() as Transform);
     this.searchTag          = ctx.reader.ReadString();
     this.maxDistance        = ctx.reader.ReadSingle();
     this.limits             = ctx.DeserializeVector3();
     this.raycast            = ctx.reader.ReadBoolean();
     this.use2DPhysics       = ctx.reader.ReadBoolean();
     this.thickRaycast       = ctx.reader.ReadBoolean();
     this.thickRaycastRadius = ctx.reader.ReadSingle();
     this.recursive          = ctx.reader.ReadBoolean();
     ctx.reader.ReadBoolean();
     this.mask = ctx.reader.ReadInt32();
     this.optimizeForSparseGraph = ctx.reader.ReadBoolean();
     ctx.reader.ReadBoolean();
 }
예제 #11
0
        public override void DeserializeSettings(GraphSerializationContext ctx)
        {
            base.DeserializeSettings(ctx);

            root                   = ctx.DeserializeUnityObject() as Transform;
            searchTag              = ctx.reader.ReadString();
            maxDistance            = ctx.reader.ReadSingle();
            limits                 = ctx.DeserializeVector3();
            raycast                = ctx.reader.ReadBoolean();
            use2DPhysics           = ctx.reader.ReadBoolean();
            thickRaycast           = ctx.reader.ReadBoolean();
            thickRaycastRadius     = ctx.reader.ReadSingle();
            recursive              = ctx.reader.ReadBoolean();
            autoLinkNodes          = ctx.reader.ReadBoolean();
            mask                   = (LayerMask)ctx.reader.ReadInt32();
            optimizeForSparseGraph = ctx.reader.ReadBoolean();
            optimizeFor2D          = ctx.reader.ReadBoolean();
        }
예제 #12
0
        public override void DeserializeExtraInfo(GraphSerializationContext ctx)
        {
            uint graphIndex = ctx.graphIndex;

            TriangleMeshNode.SetNavmeshHolder((int)graphIndex, this);

            int nodeCount   = ctx.reader.ReadInt32();
            int vertexCount = ctx.reader.ReadInt32();

            if (nodeCount == -1)
            {
                nodes            = new TriangleMeshNode[0];
                _vertices        = new Int3[0];
                originalVertices = new Vector3[0];
                return;
            }

            nodes            = new TriangleMeshNode[nodeCount];
            _vertices        = new Int3[vertexCount];
            originalVertices = new Vector3[vertexCount];

            for (int i = 0; i < vertexCount; i++)
            {
                _vertices[i]        = ctx.DeserializeInt3();
                originalVertices[i] = ctx.DeserializeVector3();
            }

            bbTree = new BBTree();

            for (int i = 0; i < nodeCount; i++)
            {
                nodes[i] = new TriangleMeshNode(active);
                TriangleMeshNode node = nodes[i];
                node.DeserializeNode(ctx);
                node.UpdatePositionFromVertices();
            }

            bbTree.RebuildFrom(nodes);
        }
예제 #13
0
        public override void DeserializeSettings (GraphSerializationContext ctx) {
            base.DeserializeSettings(ctx);

            root = ctx.DeserializeUnityObject() as Transform;
            searchTag = ctx.reader.ReadString();
            maxDistance = ctx.reader.ReadSingle();
            limits = ctx.DeserializeVector3();
            raycast = ctx.reader.ReadBoolean();
            use2DPhysics = ctx.reader.ReadBoolean();
            thickRaycast = ctx.reader.ReadBoolean();
            thickRaycastRadius = ctx.reader.ReadSingle();
            recursive = ctx.reader.ReadBoolean();
            autoLinkNodes = ctx.reader.ReadBoolean();
            mask = (LayerMask)ctx.reader.ReadInt32();
            optimizeForSparseGraph = ctx.reader.ReadBoolean();
            optimizeFor2D = ctx.reader.ReadBoolean();
        }