コード例 #1
0
 public static RaycastHit? Raycast(Vector2f start, float angle, float distance, IEnumerable<LineSegment> segments)
     => Raycast(start, start + start.AngleVec(angle) * distance, segments);
コード例 #2
0
ファイル: Debug.cs プロジェクト: Spanfile/LD33
        public static void DrawArrow(Vector2f position, float angle, float length, Color color)
        {
            var vertices = new List<Vertex>();

            var end = position + position.AngleVec(angle * (float)Math.PI / 180f) * length;

            vertices.Add(new Vertex(position, color));
            vertices.Add(new Vertex(end, color));

            var left = end + end.AngleVec((angle - 45f) * ((float)Math.PI / 180f)) * -10f;
            var right = end + end.AngleVec((angle + 45f) * ((float)Math.PI / 180f)) * -10f;

            vertices.Add(new Vertex(end, color));
            vertices.Add(new Vertex(left, color));

            vertices.Add(new Vertex(end, color));
            vertices.Add(new Vertex(right, color));

            drawInfos.Add(new DebugDrawInfo(vertices.ToArray(), PrimitiveType.Lines));
        }