using System.Xml;
using UnityEngine;

namespace DefaultNamespace
{
    public static class XmlReaderEx
    {
        public static Vector3 ReadVector3(this XmlNode vNode)
        {
            float x = float.Parse(vNode.Attributes["x"].Value);
            float y = float.Parse(vNode.Attributes["y"].Value);
            float z = float.Parse(vNode.Attributes["z"].Value);
            return new Vector3(x, y, z);
        }

        public static Vector3 ReadVector2(this XmlNode vNode)
        {
            float x = float.Parse(vNode.Attributes["x"].Value);
            float y = float.Parse(vNode.Attributes["y"].Value);
            return new Vector2(x, y);
        }

        public static Vector3 ReadUV2(this XmlNode vNode)
        {
            float x = float.Parse(vNode.Attributes["u"].Value);
            float y = float.Parse(vNode.Attributes["v"].Value);
            return new Vector2(x, y);
        }
    }
}