Пример #1
0
        public override void DeserializeExtraInfo(GraphSerializationContext ctx)
        {
            int count = ctx.reader.ReadInt32();

            if (count == -1)
            {
                nodes = null;
                return;
            }

            nodes     = new PointNode[count];
            nodeCount = count;

            for (int i = 0; i < nodes.Length; i++)
            {
                if (ctx.reader.ReadInt32() == -1)
                {
                    continue;
                }
                nodes[i] = new PointNode(active);
                nodes[i].DeserializeNode(ctx);
            }
        }
        // Token: 0x060024F4 RID: 9460 RVA: 0x0019C970 File Offset: 0x0019AB70
        protected override void DeserializeExtraInfo(GraphSerializationContext ctx)
        {
            int num = ctx.reader.ReadInt32();

            if (num == -1)
            {
                this.nodes = null;
                return;
            }
            this.nodes = new LevelGridNode[num];
            for (int i = 0; i < this.nodes.Length; i++)
            {
                if (ctx.reader.ReadInt32() != -1)
                {
                    this.nodes[i] = new LevelGridNode(this.active);
                    this.nodes[i].DeserializeNode(ctx);
                }
                else
                {
                    this.nodes[i] = null;
                }
            }
        }
Пример #3
0
        public override void DeserializeExtraInfo(GraphSerializationContext ctx)
        {
            uint graphIndex = (uint)ctx.graphIndex;

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

            int c1 = ctx.reader.ReadInt32();
            int c2 = ctx.reader.ReadInt32();

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

            nodes            = new TriangleMeshNode[c1];
            _vertices        = new Int3[c2];
            originalVertices = new Vector3[c2];

            for (int i = 0; i < c2; i++)
            {
                _vertices[i]        = new Int3(ctx.reader.ReadInt32(), ctx.reader.ReadInt32(), ctx.reader.ReadInt32());
                originalVertices[i] = new Vector3(ctx.reader.ReadSingle(), ctx.reader.ReadSingle(), ctx.reader.ReadSingle());
            }

            bbTree = new BBTree(this);

            for (int i = 0; i < c1; i++)
            {
                nodes[i] = new TriangleMeshNode(active);
                TriangleMeshNode node = nodes[i];
                node.DeserializeNode(ctx);
                node.UpdatePositionFromVertices();
                bbTree.Insert(node);
            }
        }
Пример #4
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();
            }


            for (int i = 0; i < nodeCount; i++)
            {
                nodes[i] = new TriangleMeshNode(active);
                TriangleMeshNode node = nodes[i];
                node.DeserializeNode(ctx);
                node.UpdatePositionFromVertices();
            }
        }
Пример #5
0
 public override void SerializeExtraInfo(GraphSerializationContext ctx)
 {
     if (this.nodes == null || this.originalVertices == null || this._vertices == null || this.originalVertices.Length != this._vertices.Length)
     {
         ctx.writer.Write(-1);
         ctx.writer.Write(-1);
         return;
     }
     ctx.writer.Write(this.nodes.Length);
     ctx.writer.Write(this._vertices.Length);
     for (int i = 0; i < this._vertices.Length; i++)
     {
         ctx.writer.Write(this._vertices[i].x);
         ctx.writer.Write(this._vertices[i].y);
         ctx.writer.Write(this._vertices[i].z);
         ctx.writer.Write(this.originalVertices[i].x);
         ctx.writer.Write(this.originalVertices[i].y);
         ctx.writer.Write(this.originalVertices[i].z);
     }
     for (int j = 0; j < this.nodes.Length; j++)
     {
         this.nodes[j].SerializeNode(ctx);
     }
 }
Пример #6
0
        protected override void SerializeExtraInfo(GraphSerializationContext ctx)
        {
            // Serialize node data

            if (nodes == null)
            {
                ctx.writer.Write(-1);
            }

            // Length prefixed array of nodes
            ctx.writer.Write(nodeCount);
            for (var i = 0; i < nodeCount; i++) // -1 indicates a null field
            {
                if (nodes[i] == null)
                {
                    ctx.writer.Write(-1);
                }
                else
                {
                    ctx.writer.Write(0);
                    nodes[i].SerializeNode(ctx);
                }
            }
        }
Пример #7
0
        public override void DeserializeExtraInfo(GraphSerializationContext ctx)
        {
            var graphIndex = (uint)active.astarData.GetGraphIndex(this);

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

            var c1 = ctx.reader.ReadInt32();
            var c2 = ctx.reader.ReadInt32();

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

            nodes            = new TriangleMeshNode[c1];
            _vertices        = new Int3[c2];
            originalVertices = new Vector3[c2];

            for (var i = 0; i < c2; i++)
            {
                _vertices[i]        = new Int3(ctx.reader.ReadInt32(), ctx.reader.ReadInt32(), ctx.reader.ReadInt32());
                originalVertices[i] = new Vector3(ctx.reader.ReadSingle(), ctx.reader.ReadSingle(), ctx.reader.ReadSingle());
            }


            for (var i = 0; i < c1; i++)
            {
                nodes[i] = new TriangleMeshNode(active);
                var node = nodes[i];
                node.DeserializeNode(ctx);
                node.GraphIndex = graphIndex;
                node.UpdatePositionFromVertices();
            }
        }
Пример #8
0
        public override void DeserializeReferences(GraphSerializationContext ctx)
        {
            // Grid nodes didn't serialize references before 3.8.3
            if (ctx.meta.version < AstarSerializer.V3_8_3)
            {
                return;
            }

            int count = ctx.reader.ReadInt32();

            if (count == -1)
            {
                connections = null;
            }
            else
            {
                connections = new Connection[count];

                for (int i = 0; i < count; i++)
                {
                    connections[i] = new Connection(ctx.DeserializeNodeReference(), ctx.reader.ReadUInt32());
                }
            }
        }
Пример #9
0
 public override void DeserializeNode(GraphSerializationContext ctx)
 {
     base.DeserializeNode(ctx);
     position  = ctx.DeserializeInt3();
     gridFlags = ctx.reader.ReadUInt16();
 }
Пример #10
0
 public override void SerializeNode(GraphSerializationContext ctx)
 {
     base.SerializeNode(ctx);
     ctx.SerializeInt3(position);
     ctx.writer.Write(gridFlags);
 }
Пример #11
0
        public override void DeserializeExtraInfo(GraphSerializationContext ctx) {
            int count = ctx.reader.ReadInt32();

            if (count == -1) {
                nodes = null;
                return;
            }

            nodes = new PointNode[count];
            nodeCount = count;

            for (int i = 0; i < nodes.Length; i++) {
                if (ctx.reader.ReadInt32() == -1) continue;
                nodes[i] = new PointNode(active);
                nodes[i].DeserializeNode(ctx);
            }
        }
Пример #12
0
 void IGraphInternals.PostDeserialization(GraphSerializationContext ctx)
 {
     PostDeserialization(ctx);
 }
Пример #13
0
 /** Called after all deserialization has been done for all graphs.
  * Can be used to set up more graph data which is not serialized
  */
 protected virtual void PostDeserialization(GraphSerializationContext ctx)
 {
 }
Пример #14
0
 /** Deserializes graph type specific node data.
  * \see SerializeExtraInfo
  */
 public virtual void DeserializeExtraInfo(GraphSerializationContext ctx)
 {
 }
Пример #15
0
 public virtual void DeserializeReferences(GraphSerializationContext ctx)
 {
 }
Пример #16
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();
        }
Пример #17
0
 public override void DeserializeNode(GraphSerializationContext ctx)
 {
     base.DeserializeNode(ctx);
     this.position  = new Int3(ctx.reader.ReadInt32(), ctx.reader.ReadInt32(), ctx.reader.ReadInt32());
     this.gridFlags = ctx.reader.ReadUInt16();
 }
Пример #18
0
 public virtual void SerializeServerInfo(GraphSerializationContext ctx)
 {
 }
Пример #19
0
 public virtual void SerializeNode(GraphSerializationContext ctx)
 {
     //Write basic node data.
     ctx.writer.Write(Penalty);
     ctx.writer.Write(Flags);
 }
Пример #20
0
 public virtual void SerializeNode(GraphSerializationContext ctx)
 {
     ctx.writer.Write(this.Penalty);
     ctx.writer.Write(this.Flags);
 }
Пример #21
0
 public virtual void DeserializeNode(GraphSerializationContext ctx)
 {
     this.Penalty = ctx.reader.ReadUInt32();
     this.Flags   = ctx.reader.ReadUInt32();
 }
Пример #22
0
 public override void DeserializeNode(GraphSerializationContext ctx)
 {
     base.DeserializeNode(ctx);
     position = new Int3(ctx.reader.ReadInt32(), ctx.reader.ReadInt32(), ctx.reader.ReadInt32());
 }
Пример #23
0
 protected override void PostDeserialization(GraphSerializationContext ctx)
 {
     RebuildNodeLookup();
 }
Пример #24
0
        public override void SerializeSettings (GraphSerializationContext ctx) {
            base.SerializeSettings(ctx);

            ctx.SerializeUnityObject(root);
            ctx.writer.Write(searchTag ?? "");
            ctx.writer.Write(maxDistance);
            ctx.SerializeVector3(limits);
            ctx.writer.Write(raycast);
            ctx.writer.Write(use2DPhysics);
            ctx.writer.Write(thickRaycast);
            ctx.writer.Write(thickRaycastRadius);
            ctx.writer.Write(recursive);
            ctx.writer.Write(autoLinkNodes);
            ctx.writer.Write((int)mask);
            ctx.writer.Write(optimizeForSparseGraph);
            ctx.writer.Write(optimizeFor2D);
        }
Пример #25
0
 /** Deserializes graph type specific node data.
  * \see SerializeExtraInfo
  */
 protected virtual void DeserializeExtraInfo(GraphSerializationContext ctx)
 {
 }
Пример #26
0
 public override void SerializeNode(GraphSerializationContext ctx)
 {
     base.SerializeNode(ctx);
     ctx.SerializeInt3(position);
 }
Пример #27
0
 void IGraphInternals.DeserializeExtraInfo(GraphSerializationContext ctx)
 {
     DeserializeExtraInfo(ctx);
 }
Пример #28
0
 public override void DeserializeNode(GraphSerializationContext ctx)
 {
     base.DeserializeNode(ctx);
     position = ctx.DeserializeInt3();
 }
Пример #29
0
 void IGraphInternals.DeserializeSettingsCompatibility(GraphSerializationContext ctx)
 {
     DeserializeSettingsCompatibility(ctx);
 }
Пример #30
0
        public override void SerializeExtraInfo(GraphSerializationContext ctx) {
            // Serialize node data

            if (nodes == null) ctx.writer.Write(-1);

            // Length prefixed array of nodes
            ctx.writer.Write(nodeCount);
            for (int i = 0; i < nodeCount; i++) {
                // -1 indicates a null field
                if (nodes[i] == null) ctx.writer.Write(-1);
                else {
                    ctx.writer.Write(0);
                    nodes[i].SerializeNode(ctx);
                }
            }
        }