Example #1
0
        void InitialData()
        {
            Beeline beeline = new Beeline();

            beeline.lineBase.Color = Color.red;
            beeline.lineBase.Width = 2;
            beeline.Start.x        = -100;
            beeline.End.x          = 100;
            beeline.End.y          = 100;

            ArcLine arc = new ArcLine();

            arc.Closed         = true;
            arc.lineBase.Color = Color.green;
            arc.lineBase.Width = 2;
            arc.Pos            = new Vector2(0, 220);
            arc.Scale          = new Vector2(1, 0.6f);
            arc.Dic            = 44;
            arc.Angle          = 160;
            arc.Precision      = 0.05f;
            arc.Radius         = 300;

            BzierLine bzier = new BzierLine();

            bzier.lineBase.Color = Color.blue;
            bzier.lineBase.Width = 2;
            bzier.A         = new Vector2(-11, -22);
            bzier.B         = new Vector2(0, -220);
            bzier.C         = new Vector2(100, 46);
            bzier.Precision = 0.04f;

            view.Line.AddLine(ref beeline);
            view.Line.AddLine(ref arc);
            view.Line.AddLine(ref bzier);
        }
Example #2
0
 /// <summary>
 /// 添加一条弧线
 /// </summary>
 /// <param name="line"></param>
 public void AddLine(ref ArcLine line)
 {
     if (arcLines == null)
     {
         arcLines = new List <ArcLine>();
     }
     if (line.Precision <= 0)
     {
         line.Precision = 0.01f;
     }
     arcLines.Add(line);
     m_dirty = true;
 }
Example #3
0
        void CreateArcLine(ref ArcLine line)
        {
            int   Part = (int)(1 / line.Precision);
            float p    = line.Angle / Part;

            Part++;
            float      sp    = 0 - line.Angle / 2;
            Quaternion q     = Quaternion.Euler(0, 0, line.Dic);
            bool       start = false;
            Vector2    s     = Vector2.zero;
            Vector2    frist = Vector2.zero;

            for (int i = 0; i < Part; i++)
            {
                float a = sp;
                if (a < 0)
                {
                    a += 360;
                }
                else if (sp > 360)
                {
                    a -= 360;
                }
                Vector2 v = MathH.Tan2(a);
                v.x *= line.Radius;
                v.y *= line.Radius;
                v.x *= line.Scale.x;
                v.y *= line.Scale.y;
                Vector2 e = q * v;
                if (start)
                {
                    CreateVert(ref s, ref e, ref vertInfo, ref trisInfo, ref line.lineBase.Color, line.lineBase.Width);
                }
                s     = e;
                sp   += p;
                start = true;
                if (i == 0)
                {
                    frist = e;
                }
            }
            if (line.Closed)
            {
                CreateVert(ref s, ref frist, ref vertInfo, ref trisInfo, ref line.lineBase.Color, line.lineBase.Width);
            }
        }
Example #4
0
    void Start()
    {
        arc = GetComponentInChildren <ArcLine>();

        stateMachine.AddState(InputStates.Idle, new Idle {
            obj = this
        });
        stateMachine.AddState(InputStates.Charging, new Charging {
            obj = this
        });
        stateMachine.AddState(InputStates.Released, new Released {
            obj = this
        });
        stateMachine.AddState(InputStates.Inactive, new Inactive {
            obj = this
        });
        stateMachine.ChangeState(InputStates.Inactive);
    }
Example #5
0
            bool CheckPixel(float val, float axis, bool horizontal)
            {
                if (horizontal)
                {
                    //if (ArcLine.X1.RoundF(4) == val.RoundF(4) && axis == ArcLine.Y1)
                    //    return false;
                    //if (ArcLine.X2.RoundF(4) == val.RoundF(4) && axis == ArcLine.Y2)
                    //    return false;

                    if (NegativeMotion)
                        return !ArcLine.IsGreaterThan(val, axis);
                    return !ArcLine.IsLessThan(val, axis);
                }
                else
                {
                    if (NegativeMotion)
                        return !ArcLine.IsGreaterThan(axis, val);
                    return !ArcLine.IsLessThan(axis, val);
                }
            }