Exemplo n.º 1
0
    public void GenerateNewMap(WorldData worldData)
    {
        _currentNode = GenerateGraph(worldData);

        _blob = CreateNewMapBlob();
        SaveMap();

        _currentNode.ToggleEdgeVisibility(true);
    }
Exemplo n.º 2
0
    public void LoadMap(MapBlob blob)
    {
        _blob = blob;

        // Temp
        foreach (KeyValuePair <string, MapNodeData> kvp in blob.MapNodes)
        {
            MapNode mapNode = CreateMapNode(kvp.Key);
            mapNode.InitializeFromData(kvp.Value, MapNodeTappedCallback);
        }

        for (int i = 0, count = blob.MapEdges.Count; i < count; i++)
        {
            MapEdge mapEdge = CreateMapEdge(blob.MapEdges[i].P0, blob.MapEdges[i].P1);
            mapEdge.Initialize(blob.MapEdges[i]);
        }

        _currentNode = _mapNodes[blob.CurrentNode];

        _currentNode.ToggleEdgeVisibility(true);
    }
Exemplo n.º 3
0
    private MapBlob CreateNewMapBlob()
    {
        MapBlob blob = new MapBlob();
        Dictionary <string, MapNodeData> mapNodeData = new Dictionary <string, MapNodeData>();

        foreach (KeyValuePair <string, MapNode> kvp in _mapNodes)
        {
            mapNodeData.Add(kvp.Key, kvp.Value.GetData());
        }

        List <MapEdgeData> mapEdgeData = new List <MapEdgeData>();

        for (int i = 0, count = _mapEdges.Count; i < count; i++)
        {
            mapEdgeData.Add(_mapEdges[i].GetData());
        }

        blob.MapNodes    = mapNodeData;
        blob.MapEdges    = mapEdgeData;
        blob.CurrentNode = _currentNode.NodeId;
        return(blob);
    }
Exemplo n.º 4
0
 public void SaveMapData(MapBlob blob)
 {
     _characterBlob.MapBlob = blob;
     SavePlayerData();
 }