Example #1
0
    public void Load()
    {
        filename = Application.persistentDataPath + "/" + gameObject.name + ".dat";
        NPCSpawnerData data = GameManager.Load <NPCSpawnerData>(filename);

        if (data != null)
        {
            int count = data.numNpcs;

            for (int i = 0; i < count; i++)
            {
                NPC instance = InstantiateNPC(data.npcIndicies[i], Vector2.zero);
                instance.LoadFromData(data.npcDatas[i]);

                if (!data.npcAwake[i] || instance.IsKnockedOut())
                {
                    RecallUnconditionally(i);
                }
            }
        }
    }
Example #2
0
    public void Save()
    {
        NPCSpawnerData data = new NPCSpawnerData(this);

        GameManager.Save(data, filename);
    }