示例#1
0
文件: VectorInt.cs 项目: r-bel/glorg2
 public static Vector2Int Parse(string input)
 {
     var m = vec_reg.Match(input);
     if (m.Success)
     {
         Vector2Int val = new Vector2Int();
         val.x = int.Parse(m.Groups["X"].Value);
         val.x = int.Parse(m.Groups["Y"].Value);
         return val;
     }
     else
         throw new FormatException("Input string was not in correct format");
 }
示例#2
0
文件: VectorInt.cs 项目: r-bel/glorg2
 public static bool TryParse(string input, out Vector2Int ret)
 {
     var m = vec_reg.Match(input);
     ret = new Vector2Int();
     if (m.Success)
     {
         if(int.TryParse(m.Groups["X"].Value, out ret.x))
             return int.TryParse(m.Groups["Y"].Value, out ret.y);
         else
             return false;
     }
     else
         return false;
 }
示例#3
0
文件: VectorInt.cs 项目: r-bel/glorg2
 public static int Dot(Vector2Int a, Vector2Int b)
 {
     return a.x * b.x + a.y * b.y;
 }