예제 #1
0
    /// <summary>
    /// How To create new Spawned Data for terrain
    ///
    /// make  :
    ///spawnedData = XMLSerie.ReadXMLSpawned(true)
    ///spawnedData = XMLSerie.ReadXMLSpawned()
    ///
    /// </summary>
    public void LoadData()
    {
        try
        {
            if (!Program.gameScene.IsDefaultTerreno())
            {
                spawnedData = XMLSerie.ReadXMLSpawned();

                if (spawnedData == null)
                {
                    Debug.Log("spawnedData == null big");
                }
            }
            else//the first teraain to load
            {
                spawnedData = XMLSerie.ReadXMLSpawned(true);//true once Terrain.Spawned is created

                if (spawnedData == null)
                {
                    Debug.Log("spawnedData == null DefaultLoad");
                }
            }
        }
        catch (Exception exception)
        { print("error loading XMLSerie.ReadXMLSpawned()." + exception.GetBaseException().Message); }

        //print(spawnedData.TerraMshCntrlAllVertexIndexCount + "spawnedData.TerraMshCntrlAllVertexIndexCount");
        //print(Terreno.MeshController.AllVertexs.Count + "Terreno.MeshController.AllVertexs.Count");

        if (spawnedData == null)
        {
            return;
        }
        if (spawnedData.TerraMshCntrlAllVertexIndexCount != p.MeshController.AllVertexs.Count)
        {
            print("subMesh loaded not the same as the one was the spawned obj created with");
            IsToSave = true;
            ClearCurrentFileAndList();
            return;
        }

        AllSpawnedDataList = spawnedData.AllSpawnedObj;
        p.TerraSpawnController.IsToLoadFromFile = true;
    }