Ejemplo n.º 1
0
    void Update()
    {
        if (ranTests)
        {
            return;
        }

        // Just some smoke tests to make sure we don't segfault.
        var gState = GetComponent <GlobalStateScript>();

        if (!gState.IsPathfinderEnabled())
        {
            return;
        }

        var path = new PFPath();

        // We should be able to clone paths.
        path.Clone();

        var canvas = new PFCanvas(gState.GetFontContext(), new Vector2(10, 10));

        // We should be able to pass empty strings.
        canvas.FillText("", new Vector2(0, 0));

        ranTests = true;
        print("Successfully ran smoke tests.");
    }
    private void DrawInstructions(PFCanvas canvas)
    {
        canvas.SetFillStyle(Color.black);
        canvas.SetFontSize(24.0f);
        var textWidth = canvas.MeasureText(instructions).width;

        canvas.FillText(
            instructions,
            new Vector2(Screen.width / 2 - textWidth / 2, 40.0f)
            );
    }