| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
 | | using UnityEngine; |  |   |  | public class DrawUtility { |  |   |  |     // ------------------------------------------------------------------  |  |     // Desc: DrawCircle |  |     // ------------------------------------------------------------------  |  |   |  |     // DrawCircleX |  |     public static void DrawCircleX(Vector3 _center, float _radius, Color _color, float _duration = 0.0f, bool _depthTets = true) { |  |         DrawCircle(Quaternion.Euler(0.0f, 0.0f, 90.0f), _center, _radius, _color, _duration, _depthTets); |  |     } |  |   |  |     // DrawCircleY |  |     public static void DrawCircleY(Vector3 _center, float _radius, Color _color, float _duration = 0.0f, bool _depthTets = true) { |  |         DrawCircle(Quaternion.identity, _center, _radius, _color, _duration, _depthTets); |  |     } |  |   |  |     // DrawCircleZ |  |     public static void DrawCircleZ(Vector3 _center, float _radius, Color _color, float _duration = 0.0f, bool _depthTets = true) { |  |         DrawCircle(Quaternion.Euler(90.0f, 0.0f, 0.0f), _center, _radius, _color, _duration, _depthTets); |  |     } |  |   |  |     public static void DrawTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Color color) { |  |         Debug.DrawLine(p1, p2, color); |  |         Debug.DrawLine(p2, p3, color); |  |         Debug.DrawLine(p3, p1, color); |  |     } |  |   |  |   |  |     public static void DrawCircle(Quaternion _rot, Vector3 _center, float _radius, Color _color, float _duration = 0.0f, bool _depthTets = true) { |  | #if UNITY_EDITOR |  |         // |  |         float two_pi = 2.0f * Mathf.PI; |  |         float segments = 32.0f; |  |         float step = two_pi / segments; |  |         float theta = 0.0f; |  |   |  |         // |  |         Vector3 last = _center + _rot * (_radius * new Vector3(Mathf.Cos(theta), 0.0f, Mathf.Sin(theta))); |  |         theta += step; |  |   |  |         // |  |         for (int i = 1; i <= segments; ++i) { |  |             Vector3 cur = _center + _rot * (_radius * new Vector3(Mathf.Cos(theta), 0.0f, Mathf.Sin(theta))); |  |             Debug.DrawLine(last, cur, _color, _duration, _depthTets); |  |             last = cur; |  |             theta += step; |  |         } |  | #endif |  |     } |  |   |  |     // ------------------------------------------------------------------  |  |     // Desc:  |  |     // ------------------------------------------------------------------  |  |   |  |     public static void DrawBall(Vector3 _center, float _radius, Color _color, float _duration = 0.0f, bool _depthTets = true) { |  |         DrawCircleX(_center, _radius, _color, _duration, _depthTets); |  |         DrawCircleY(_center, _radius, _color, _duration, _depthTets); |  |         DrawCircleZ(_center, _radius, _color, _duration, _depthTets); |  |     } |  | } | 
 |