Esempio n. 1
0
    public Beast LoadBeasts()
    {
        string data = Resources.Load<TextAsset>("output").text;
        string[] lines = data.Split('\n');
        //Dictionary<string, Beast> beasts = new Dictionary<string, Beast>();
        foreach (string line in lines) {
          if (line.Length < 1 || line[0] == '#') {
        continue;
          }
          string[] parts = line.Split(',');
          string id = parts[0];
          Sprite sprite = this.LoadSprite(parts[1]);
          Beast b = new Beast();
          b.sprite = sprite;
          this.beasts.Add(id, b);
        }

        foreach (string line in lines) {
          if (line.Length < 1 || line[0] == '#') {
        continue;
          }
          string[] parts = line.Split(',');
          string id = parts[0];
          Beast b = this.beasts[id];
          b.right = this.beasts[parts[2]];
          b.up = this.beasts[parts[3]];
          b.left = this.beasts[parts[4]];
          b.down = this.beasts[parts[5]];
          b.inner = this.beasts[parts[6]];
          b.SetSong(parts[7].Replace('/', ','));
          b.tickTime = float.Parse(parts[8]);
          b.currentTickTime = float.Parse(parts[8]);
        }

        return this.beasts["player"];
    }