Пример #1
0
    void DrawFace()
    {
        Vector3 pos = faceCursor.transform.position;

        bar.MakeArc(pos, radius, radius, -90.0f, 90.0f);
        bar.Draw();
    }
Пример #2
0
 // Start is called before the first frame update
 void Start()
 {
     arcLine    = new VectorLine("Line", linePoints, 2.0f);
     linePoints = new List <Vector3>()
     {
         new Vector3(20, 30, 0), new Vector3(100, 50, 1)
     };
     arcLine.MakeArc(Vector3.zero, 0, 0, 45.0f, 315.0f);
 }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        departure   = GameObject.FindGameObjectWithTag("JP");
        destination = GameObject.FindGameObjectWithTag("CA");

        float   dist       = Vector3.Distance(departure.transform.position, destination.transform.position);
        Vector3 midpoint   = (departure.transform.position + destination.transform.position) * 0.5f;
        var     linepoints = new List <Vector3>(21);

        VectorLine arc = new VectorLine("Arc", linepoints, 4.0f, LineType.Continuous);

        arc.MakeArc(midpoint, dist / 2, dist / 2, 0.0f, 360.0f, 20);
        arc.Draw3D();
    }
Пример #4
0
    void Start()
    {
        position = new Vector2(radius + 20, Screen.height - (radius + 20));

        // Set up a white circle for the background of the power bar
        var circle = new VectorLine("BarBackground", new List <Vector2>(50), null, lineWidth, LineType.Continuous, Joins.Weld);

        circle.MakeCircle(position, radius);
        circle.Draw();

        // Make the power bar by drawing a 270° arc
        bar       = new VectorLine("TotalBar", new List <Vector2>(segmentCount + 1), null, lineWidth - 4, LineType.Continuous, Joins.Weld);
        bar.color = Color.black;
        bar.MakeArc(position, radius, radius, 0.0f, 270.0f);
        bar.Draw();

        currentPower = Random.value;
        SetTargetPower();
        // Set the initial bar colors by coloring the segments from the beginning to the current power level
        bar.SetColor(Color.red, 0, (int)Mathf.Lerp(0, segmentCount, currentPower));
    }