예제 #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 SerializedJumpConnection(NavmeshLayserSerializer ns, CellContentPointedConnection connection)
 {
     interconnection    = connection.interconnection;
     connectedCell      = ns.GetCellID(connection.connection);
     enterPoint         = connection.enterPoint;
     lowerStandingPoint = connection.lowerStandingPoint;
     exitPoint          = connection.exitPoint;
     axis      = connection.axis;
     jumpState = (int)connection.jumpState;
 }
 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 SerializedBattleGrid(NavmeshLayserSerializer ns, BattleGrid bg)
        {
            lengthX = bg.lengthX;
            lengthZ = bg.lengthZ;

            points = new List <SerializedBattleGridPoint>();
            foreach (var p in bg.points)
            {
                points.Add(new SerializedBattleGridPoint(ns, p));
            }
        }
        public SerializedCover(NavmeshLayserSerializer ns, Cover cover)
        {
            coverType = cover.coverType;
            left      = cover.left;
            right     = cover.right;
            normal    = cover.normalV3;

            foreach (var p in cover.coverPoints)
            {
                coverPoints.Add(new SerializedCoverPoint(p, ns.GetCellID(p.cell)));
            }
        }
 public SerializedBattleGridPoint(NavmeshLayserSerializer ns, BattleGridPoint point)
 {
     position    = point.positionV3;
     gridX       = point.gridX;
     gridZ       = point.gridZ;
     id          = ns.GetBattleGridID(point);
     passability = (int)point.passability;
     neighbours  = new int[4];
     for (int i = 0; i < 4; i++)
     {
         neighbours[i] = point.neighbours[i] != null?ns.GetBattleGridID(point.neighbours[i]) : -1;
     }
 }
        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));
                }
            }
        }
 public GraphSerializer(NavmeshLayserSerializer ns, Graph graph)
 {
     this.ns    = ns;
     this.graph = graph;
 }