public NavmeshLayerDeserializer(SerializedNavmesh serializedData, AgentProperties properties)
 {
     _properties     = properties;
     _serializedData = serializedData;
     cellPool        = new Cell[serializedData.cellCount];
     if (properties.battleGrid && serializedData.bgPointsCount != 0)
     {
         bgPool = new BattleGridPoint[serializedData.bgPointsCount];
     }
 }
Beispiel #2
0
        public NavmeshLayerDeserializer(SerializedNavmesh serializedData, AgentProperties properties, GameObject[] gameObjectLibrary)
        {
            _properties     = properties;
            _serializedData = serializedData;
            cellPool        = new Cell[serializedData.cellCount];
            if (properties.battleGrid && serializedData.bgPointsCount != 0)
            {
                bgPool = new BattleGridPoint[serializedData.bgPointsCount];
            }

            this.gameObjectLibrary = gameObjectLibrary;
        }
        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);
        }