Exemple #1
0
    void load()
    {
        string path = Application.dataPath + "/Resources/Data/Enemies/";

        if (System.IO.File.Exists(path + "Teams.bytes"))
        {
            var data = PersistantData.ReadBytesFromFile(path, "Teams.bytes");
            _teamList = PersistantData.DeserializeToType <List <EnemyList> >(data);
        }
    }
Exemple #2
0
    void LoadEnemy(string name)
    {
        string path = Application.dataPath + "/Resources/Data/Enemies/";

        if (System.IO.File.Exists(path + name + ".bytes"))
        {
            var data = PersistantData.ReadBytesFromFile(path, name + ".bytes");
            _enemy = PersistantData.DeserializeToType <Character>(data);
        }
    }
Exemple #3
0
    private void Awake()
    {
        TextAsset assest = Resources.Load("Data/Enemies/Teams") as TextAsset;

        if (assest != null)
        {
            EnemyGroups = PersistantData.DeserializeToType <List <EnemyList> >(assest);
        }
        else
        {
            Debug.LogError("Failed to load enemy teams");
        }
    }
Exemple #4
0
    public static Character CreateEnemyInstance(string filename)
    {
        Character enemy = new Character();

        TextAsset assest = Resources.Load("Data/Enemies/" + filename) as TextAsset;

        if (assest != null)
        {
            enemy       = PersistantData.DeserializeToType <Character>(assest);
            enemy.Alive = true;
            return(enemy);
        }
        Debug.LogError("Failed to load enemy from file with the name of " + filename);
        return(null);
    }