Archived
虽然经历了固态硬盘损坏,但好在git给力,丢失的文件不多
This commit is contained in:
@@ -6,7 +6,7 @@ using UnityEngine;
|
||||
namespace XericLibrary.Runtime.Type
|
||||
{
|
||||
/// <summary>
|
||||
/// ʸ����λ
|
||||
/// 三维方向指示
|
||||
/// </summary>
|
||||
public enum Vector3Orientation
|
||||
{
|
||||
@@ -18,7 +18,7 @@ namespace XericLibrary.Runtime.Type
|
||||
Right,
|
||||
}
|
||||
/// <summary>
|
||||
/// ʸ����λ
|
||||
/// 二维方向指示
|
||||
/// </summary>
|
||||
public enum Vector2Orientation
|
||||
{
|
||||
@@ -27,4 +27,33 @@ namespace XericLibrary.Runtime.Type
|
||||
Left,
|
||||
Right,
|
||||
}
|
||||
public static class OrientationExtend
|
||||
{
|
||||
public static Vector3 GetVector(this Vector3Orientation orient)
|
||||
{
|
||||
return orient switch
|
||||
{
|
||||
Vector3Orientation.Front => Vector3.forward,
|
||||
Vector3Orientation.Back => Vector3.back,
|
||||
Vector3Orientation.Up => Vector3.up,
|
||||
Vector3Orientation.Down => Vector3.down,
|
||||
Vector3Orientation.Left => Vector3.left,
|
||||
Vector3Orientation.Right => Vector3.right,
|
||||
_=> Vector3.zero,
|
||||
};
|
||||
}
|
||||
|
||||
public static Vector2 GetVector(this Vector2Orientation orient)
|
||||
{
|
||||
return orient switch
|
||||
{
|
||||
Vector2Orientation.UpFront => Vector2.up,
|
||||
Vector2Orientation.DownBack => Vector2.down,
|
||||
Vector2Orientation.Left => Vector2.left,
|
||||
Vector2Orientation.Right => Vector2.right,
|
||||
_=> Vector2.zero,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user