An open source Danmaku development kit for Unity3D.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add utilty methods/functions for getting Directions

james713 51fad1ed 4be6ba71

+14
+14
Assets/DanmakU/Runtime/Core/Danmaku.cs
··· 66 66 } 67 67 68 68 /// <summary> 69 + /// Gets the direction the Danmaku is facing. Guarenteed to be a unit vector. 70 + /// </summary> 71 + public Vector2 Direction => GetDirection(Pool.Rotations[Id]); 72 + 73 + /// <summary> 69 74 /// Gets or sets the speed of the Danmaku. 70 75 /// </summary> 71 76 /// <remarks> ··· 152 157 Speed = state.Speed; 153 158 AngularSpeed = state.AngularSpeed; 154 159 Color = state.Color; 160 + } 161 + 162 + /// <summary> 163 + /// Convert a Danmaku rotation into a unit vector. 164 + /// </summary> 165 + /// <param name="rotation">the rotation of the Danmaku.</param> 166 + /// <returns>the unit vector representing the way the bullet is facing.</returns> 167 + public static Vector2 GetDirection(float rotation) { 168 + return new Vector2(Mathf.Cos(rotation), Mathf.Sin(rotation)); 155 169 } 156 170 157 171 public static bool operator ==(Danmaku lhs, Danmaku rhs) {