Пример #1
0
    public bool HoldEnemyData()
    {
        MapEnemyData save = new MapEnemyData();

        foreach (Enemy e in GameManager.instance.GetEnemyList())
        {
            save.Enemies.Add(e.Status);
            save.LogicalPos.Add(e.logicalPos);
        }

        SaveManager.HoldJson("/_Save/JsonData/Map/" + MapID + "/" + level, "/Enemies.json",
                             JsonUtility.ToJson(save, true));
        return(true);
    }
Пример #2
0
    public bool LoadEnemyData()
    {
        if (!EnemyManager.instance)
        {
            return(false);
        }
        MapEnemyData save = new MapEnemyData();
        string       json = SaveManager.LoadJson("/_Save/JsonData/Map/" + MapID + "/" + level, "/Enemies.json");

        if (json == "")
        {
            return(false);
        }
        save = JsonUtility.FromJson <MapEnemyData>(json);

        for (int i = 0; i < save.Enemies.Count; i++)
        {
            EnemyManager.instance.GenerateEnemyFromStatus(save.Enemies[i], save.LogicalPos[i]);
        }

        return(true);
    }