예제 #1
0
        public override void Update()
        {
            if (this.ProgressIndefinitely)
            {
                this.Progress += (1 - this.Progress) / 200;
            }

            if (this.Started)
            {
                if (!this.Finished)
                {
                    this.RealProgress += (this.TargetProgress - this.RealProgress) * 0.1;
                    //if (this.TargetProgress == 1)
                    //{
                    //	this.Finished = true;
                    //	this.Kill();
                    //}

                    if ((this.Runtime - 20) % 120 < 60)
                    {
                        this.LineProgress = 0;
                    }
                    else
                    {
                        this.LineProgress = Meth.Smooth(((this.Runtime - 20) % 120 - 60) / 60.0);
                    }
                }
                else
                {
                    this.RealProgress *= 0.9;
                    this.LineProgress -= 1 / 10.0;

                    this.Graphics.Remove(this.OuterRing);
                    Bunch <Vector> vs = new Bunch <Vector>();
                    for (int i = 0; i <= 20; i++)
                    {
                        vs.Add(Vector.FromAngle(i / 20.0 * Meth.Tau, 8 * Meth.Root(this.RealProgress)));
                    }
                    this.OuterRing = Line.DrawMultiple(vs, Color.Black, 1);
                    this.Graphics.Add(this.OuterRing);

                    this.Text.Scale      = new Vector(Meth.Square(this.RealProgress), this.RealProgress);
                    this.Text.Position.X = this.RealProgress * 10;

                    if (this.RealProgress < 0.001)
                    {
                        this.Kill();
                    }
                }
            }
            else
            {
                this.LineProgress += (1 - this.LineProgress) * 0.1;

                this.RealProgress += (this.TargetProgress - this.RealProgress) * 0.1;
                this.RealProgress  = Meth.Min(this.LineProgress, this.RealProgress);

                this.Graphics.Remove(this.OuterRing);
                Bunch <Vector> vs = new Bunch <Vector>();
                for (int i = 0; i <= 20; i++)
                {
                    vs.Add(Vector.FromAngle(i / 20.0 * Meth.Tau, 8 * this.LineProgress));
                }
                this.OuterRing = Line.DrawMultiple(vs, Color.Black, 1);
                this.Graphics.Add(this.OuterRing);

                this.Text.Scale      = new Vector(Meth.Square(this.LineProgress), this.LineProgress);
                this.Text.Position.X = this.LineProgress * 10;

                if (this.LineProgress > 0.99)
                {
                    this.LineProgress = 1;
                    this.Started      = true;
                }
            }

            this.Graphics.Remove(this.InnerRing);

            Bunch <Vector> ps = new Bunch <Vector>();

            for (int i = 0; i <= 20; i++)
            {
                ps.Add(Vector.FromAngle(i / 20.0 * Meth.Tau, 8 * this.RealProgress));
            }
            this.InnerRing = Line.DrawMultiple(ps, Color.Black, 1);
            this.Graphics.Add(this.InnerRing);

            this.Lines.Vertices.Clear();
            this.Lines.Add(0);
            this.Lines.Add(Vector.FromAngle(this.LineProgress * Meth.Tau, 8 * this.RealProgress));
            this.Lines.Add(Vector.FromAngle(this.LineProgress * -Meth.Tau - Meth.Tau / 2, 8 * this.RealProgress));
            this.Lines.Add(Vector.FromAngle(this.LineProgress * -Meth.Tau - Meth.Tau / 2, this.Finished ? 8 * Meth.Root(this.RealProgress) : 8));
        }
예제 #2
0
        public override void Update()
        {
            if (this.Enabled)
            {
                if (this.Progress < 0.01)
                {
                    this.Progress = 0;
                }
                if (this.Progress > 0.99)
                {
                    this.Progress = 1;
                }

                if (this.MouseArea.IsHovered)
                {
                    if (!this.MouseArea.IsClicked)
                    {
                        this.Progress -= (this.Progress - (this.Checked ? 0.7 : 0.2)) * 0.4;
                    }
                    else
                    {
                        this.Progress -= (this.Progress - (this.Checked ? 1 : 0)) * 0.5;
                    }
                }
                else
                {
                    this.JustClicked = false;
                    this.Progress   -= (this.Progress - (this.Checked ? 1 : 0)) * 0.5;
                }
            }
            else
            {
                this.Progress = this.Checked ? 1 : 0;
            }

            this.VertexArray.Vertices.Clear();
            for (int i = 0; i < 4; i++)
            {
                this.VertexArray.Vertices.Add(Size / 2 + 0.5 + Vector.FromAngle(i * Meth.Tau / 4 - Meth.Tau / 8, Size / 3 * Meth.Root(2)));
                this.VertexArray.Vertices.Add(Size / 2 + 0.5 + Vector.FromAngle(i * Meth.Tau / 4 - Meth.Tau / 8, Size / 3 * Meth.Root(2)) + Vector.FromAngle(i * Meth.Tau / 4 + Meth.Tau / 4 + Progress * Meth.Tau / 8, Size / 1.5 * (1 - Meth.Pow(Progress, 1.2)) + Size / 3 * Meth.Root(2) * Progress * 1.05));
                //this.VertexArray.Vertices.Add(new Vertex(Size / 2 + 0.5 + Vector.FromAngle(i * Meth.Tau / 4 + Meth.Tau / 8, Size / 3 * Meth.Root(2) * (1 - Progress)) + Vector.FromAngle(i * Meth.Tau / 4 - Meth.Tau / 8, -1 * Meth.Root(2) * Progress), Color.Black));
            }
        }