12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using UnityEngine;
- namespace XGame.Database
- {
- public static class VectorUtils
- {
- ///// <summary>
- ///// Vector3 -> Vec3 µÄ±¶Êý
- ///// </summary>
- //public static readonly int Multiple = 1000;
- #region Vec3
- /// <summary>
- /// Vec3 -> Vector3
- /// </summary>
- /// <param name="vec"></param>
- /// <returns></returns>
- public static Vector3 ToVector3(this Vec3 vec)
- {
- return new Vector3(vec.X, vec.Y, vec.Z);
- }
- /// <summary>
- /// Vec3 -> Vector3Int
- /// </summary>
- /// <param name="vec"></param>
- /// <returns></returns>
- public static Vector3Int ToVector3Int(this Vec3 vec)
- {
- return Vector3Int.RoundToInt(new Vector3(vec.X, vec.Y, vec.Z));
- }
- #endregion
- #region Vec2
- /// <summary>
- /// Vec2 -> Vector2
- /// </summary>
- /// <param name="vec"></param>
- /// <returns></returns>
- public static Vector2 ToVector2(this Vec2 vec)
- {
- return new Vector2(vec.X, vec.Y);
- }
- /// <summary>
- /// Vec2 -> Vector2Int
- /// </summary>
- /// <param name="vec"></param>
- /// <returns></returns>
- public static Vector2Int ToVector2Int(this Vec2 vec)
- {
- return Vector2Int.RoundToInt(new Vector2(vec.X, vec.Y));
- }
- #endregion
- }
- }
|