DataParse.cs 728 B

12345678910111213141516171819202122232425
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. public static class DataParse
  4. {
  5. public static Color StringToColor(this string str)
  6. {
  7. string[] strings = str.Split(' ');
  8. return new Color(float.Parse(strings[0]), float.Parse(strings[1]), float.Parse(strings[2]), float.Parse(strings[3]));
  9. }
  10. public static Vector3[] StringToTransform(this string str)
  11. {
  12. string[] strings = str.Split(' ');
  13. Vector3[] vectors = new[]
  14. {
  15. new Vector3(float.Parse(strings[0]), float.Parse(strings[1]), float.Parse(strings[2])),
  16. new Vector3(float.Parse(strings[3]), float.Parse(strings[4]), float.Parse(strings[5])),
  17. };
  18. return vectors;
  19. }
  20. }