コード例 #1
0
ファイル: ChaseAI.cs プロジェクト: AppleConnoiseur/Beskyddare
        public void PaintDebug(DebugDrawer drawer)
        {
            if (Settings.Data.debugMode)
            {
                Movable locomotion = Locomotion;

                drawer.DrawCircle(drawer.Position, Controller.searchRadius, new Color(1.0f, 0.0f, 0.0f, 0.2f));
                //drawer.DrawLine(drawer.Position, debugHitLocation.RelativeTo(locomotion.GlobalPosition), new Color(0.0f, 1.0f, 0.0f), 2f, true);
                if (target != null)
                {
                    const float size = 24f;
                    drawer.DrawRect(new Rect2(target.Location.RelativeTo(locomotion.GlobalPosition) - new Vector2(size / 2f, size / 2f), size, size), new Color(0.0f, 1.0f, 0.0f), false);
                }

                if (state == ChaseAIState.Wandering)
                {
                    drawer.DrawLine(drawer.Position, target.Location.RelativeTo(locomotion.GlobalPosition), new Color(0.0f, 0.0f, 1.0f), 2f, true);
                    drawer.DrawCircle(target.Location.RelativeTo(locomotion.GlobalPosition), 8f, new Color(0.0f, 0.0f, 1.0f));
                }
                else if (state == ChaseAIState.Chasing)
                {
                    drawer.DrawLine(drawer.Position, target.Location.RelativeTo(locomotion.GlobalPosition), new Color(1.0f, 0.0f, 0.0f), 2f, true);
                    drawer.DrawCircle(target.Location.RelativeTo(locomotion.GlobalPosition), 8f, new Color(1.0f, 0.0f, 0.0f));
                }
            }
        }
コード例 #2
0
    private static unsafe void DrawTests(int threadIndex, float3 start, float3 end, NativeString512 text, DrawingMethods methods, NativeArray <float3> polygon)
    {
        float3 offset = Vector3.up * 0.05f + Vector3.left * 0.05f;
        float3 center = (start + (end - start) / 2);

        if (methods.Sphere)
        {
            DebugDrawer.DrawSphere(start, 0.75f, UnityColors.GhostDodgerBlue);
        }

        if (methods.RectangleWithOutline)
        {
            var size   = 0.25f;
            var points = stackalloc[]
            {
                center + offset + new float3(0, 0, 0),
                center + offset + new float3(0, size, 0),
                center + offset + new float3(0, size, size),
                center + offset + new float3(0, 0, size)
            };

            DebugDrawer.DrawSolidRectangleWithOutline(points, UnityColors.LightYellow, UnityColors.Yellow);
        }

        if (methods.Polygon)
        {
            DebugDrawer.DrawAAConvexPolygon(polygon, center + (float3)Vector3.down * 0.25f, UnityColors.GhostDodgerBlue);
        }

        if (methods.Line)
        {
            DebugDrawer.DrawLine(start + offset, end + offset);
        }

        if (methods.Ray)
        {
            DebugDrawer.DrawRay(center, Vector3.up, UnityColors.MediumBlue);
        }

        if (methods.Cone)
        {
            DebugDrawer.DrawCone(center + (float3)Vector3.up * 0.5f, Vector3.up, UnityColors.DarkKhaki, 22.5f);
        }

        if (methods.Circle)
        {
            DebugDrawer.DrawCircle(center, Vector3.up, 0.25f, UnityColors.AliceBlue);
        }

        if (methods.DottedLine)
        {
            DebugDrawer.DrawDottedLine(start, end, Color.yellow);
        }

        if (methods.WireCube)
        {
            DebugDrawer.DrawWireCube(end, Vector3.one / 2, Color.yellow);
        }

        if (methods.DottedWireCube)
        {
            DebugDrawer.DrawDottedWireCube(end, Vector3.one, Color.black);
        }

        if (methods.Label)
        {
            DebugDrawer.DrawLabel(center + (float3)Vector3.down * 0.25f, text);
        }

        if (methods.Arrow)
        {
            DebugDrawer.DrawArrow(start + (float3)Vector3.up * 0.5f, Vector3.up, Color.blue);
        }

        if (methods.Log)
        {
            DebugDrawer.Log(threadIndex, text);
        }

        if (methods.LogWarning)
        {
            DebugDrawer.LogWarning(text);
        }

        if (methods.LogError)
        {
            DebugDrawer.LogError(text);
        }

        if (methods.Point)
        {
            DebugDrawer.DrawPoint(center + (float3)Vector3.forward, UnityColors.Lavender, 0.25f);
        }
    }
}