コード例 #1
0
 public void OnBeforeSerialize()
 {
     if (navMesh != null)
     {
         serializableNavMesh = navMesh.AsSerialiableNavMesh();
     }
 }
コード例 #2
0
    public SerialiableNavMesh AsSerialiableNavMesh()
    {
        SerialiableNavMesh ret = new SerialiableNavMesh();

        if (connections != null)
        {
            ret.connections = FUtils.FlatMap(connections.Keys, from =>
                                             FUtils.Map(connections[from], to => new CellConnection(from, to)));
        }
        else
        {
            ret.connections = new List <CellConnection>();
        }

        if (positions != null)
        {
            ret.positions = FUtils.Map(positions.Keys, from =>
                                       new CellPosition(from, positions[from]));
        }
        else
        {
            ret.positions = new List <CellPosition>();
        }

        return(ret);
    }
コード例 #3
0
    public void OnBeforeSerialize()
    {
        if (entityField != null)
        {
            entityFieldData = entityField.asEntityFieldData();
        }

        if (navMesh != null)
        {
            serializableNavMesh = navMesh.AsSerialiableNavMesh();
        }
    }
コード例 #4
0
    public NavMesh(SerialiableNavMesh s)
    {
        connections = new Dictionary <CellIndex, List <CellIndex> >();
        positions   = new Dictionary <CellIndex, Vector3>();

        if (s.connections != null)
        {
            foreach (CellConnection c in s.connections)
            {
                AddAdjacency(c.from, c.to);
            }
        }

        if (s.positions != null)
        {
            foreach (CellPosition p in s.positions)
            {
                AddCellPosition(p.index, p.position);
            }
        }
    }