diff options
Diffstat (limited to 'SurvivalTest/Assets/Scripts/TopDown/TopDownUtils.cs')
-rw-r--r-- | SurvivalTest/Assets/Scripts/TopDown/TopDownUtils.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/SurvivalTest/Assets/Scripts/TopDown/TopDownUtils.cs b/SurvivalTest/Assets/Scripts/TopDown/TopDownUtils.cs new file mode 100644 index 0000000..f42e123 --- /dev/null +++ b/SurvivalTest/Assets/Scripts/TopDown/TopDownUtils.cs @@ -0,0 +1,25 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class TopDownUtils +{ + + /// <summary> + /// 从TopDown空间转到3D空间下(TopDownTransform -> Transform) + /// </summary> + /// <param name="topDownCoord"></param> + /// <param name="z"></param> + /// <returns></returns> + public static Vector3 Project(Vector3 topDownCoord, float z = 0) + { + Vector3 pos = new Vector3(); + + pos.x = topDownCoord.x; + pos.y = topDownCoord.y + topDownCoord.z; + pos.z = z; + + return pos; + } + +}
\ No newline at end of file |