예제 #1
0
        public SerializedCell(NavmeshLayserSerializer ns, GraphSerializer gs, Cell cell)
        {
            id    = ns.GetCellID(cell);
            layer = cell.layer;

            isAdvancedAreaCell = cell.advancedAreaCell;
            if (cell.advancedAreaCell)
            {
                AreaAdvanced aa = cell.area as AreaAdvanced;
                area = ns.GetGameObjectID(aa.container.gameObject);
            }
            else
            {
                area = cell.area.id;
            }

            passability = (int)cell.passability;
            center      = cell.centerVector3;

            data          = new List <CellContentData>(cell.data);
            originalEdges = new List <CellContentData>(cell.originalEdges);

            foreach (var connection in cell.connections)
            {
                if (connection is CellContentGenericConnection)
                {
                    serializedNormalConnections.Add(new SerializedNormalConnection(ns, gs, connection as CellContentGenericConnection));
                }

                if (connection is CellContentPointedConnection)
                {
                    serializedJumpConnections.Add(new SerializedJumpConnection(ns, connection as CellContentPointedConnection));
                }
            }
        }
 public SerializedNormalConnection(NavmeshLayserSerializer ns, GraphSerializer gs, CellContentGenericConnection connection)
 {
     interconnection = connection.interconnection;
     fromCell        = ns.GetCellID(connection.from);
     connectedCell   = ns.GetCellID(connection.connection);
     data            = connection.cellData;
     intersection    = connection.intersection;
     costFrom        = connection.costFrom;
     costTo          = connection.costTo;
 }
        public SerializedNavmesh Serialize()
        {
            SerializedNavmesh serializedNM = new SerializedNavmesh();

            serializedNM.serializedGraphs = new List <SerializedGraph>();

            foreach (var graph in targetGraphs)
            {
                GraphSerializer serializer = new GraphSerializer(this, graph);
                serializedNM.serializedGraphs.Add(serializer.Serialize());
            }

            serializedNM.cellCount     = cells.Count;
            serializedNM.bgPointsCount = bgIDs.Count;

            Debug.LogFormat("saved {0} graphs", serializedNM.serializedGraphs.Count);
            return(serializedNM);
        }
        public SerializedCell(NavmeshLayserSerializer ns, GraphSerializer gs, Cell cell)
        {
            id          = ns.GetCellID(cell);
            layer       = cell.layer;
            area        = cell.area.id;
            passability = (int)cell.passability;
            center      = cell.centerV3;

            data          = new List <CellContentData>(cell.data);
            originalEdges = new List <CellContentData>(cell.originalEdges);

            foreach (var connection in cell.connections)
            {
                if (connection is CellContentGenericConnection)
                {
                    serializedNormalConnections.Add(new SerializedNormalConnection(ns, gs, connection as CellContentGenericConnection));
                }

                if (connection is CellContentPointedConnection)
                {
                    serializedJumpConnections.Add(new SerializedJumpConnection(ns, connection as CellContentPointedConnection));
                }
            }
        }