示例#1
0
 public MyParticle(MyParticles parent, Vector2 position)
 {
     fParent = parent;
     GetNewInnerDestination();
     Position    = position;
     Destination = position;
 }
示例#2
0
        private void DrawDigit(int digitIndex, int digit, double milliseconds)
        {
            MyParticles particles = null;

            int ox = 0;
            int dx = SIZE * SEGMENTS_X;

            if (digitIndex == 0)
            {
                particles = Particles1;
                ox        = OrigoX - dx / 2;
            }
            else
            {
                particles = Particles2;
                ox        = OrigoX + dx / 2;
            }


            LineConnector connector = GetDigit(digit);

            if (connector != null)
            {
                double f = milliseconds / 1000.0f;

                var points = connector.DistributePoints(particles.Count, f);
                for (int i = 0; i < points.Count; i++)
                {
                    var particle = particles[i];
                    var point    = points[i];
                    int position = 2 * Radius * i / particles.Count - Radius;
                    particle.Destination = new Vector2(ox + point.X, OrigoY + point.Y);
                }
            }
        }
示例#3
0
        public DownCounterEffect(DateTime goalDate, int w, int h, int points)
        {
            fGoalDate      = goalDate;
            fParticles     = new MyParticles[12];
            fCurrentDigits = new DigitType[12];
            for (int i = 0; i < 12; i++)
            {
                fParticles[i]          = new MyParticles(w, h, points);
                fParticles[i].Settings = ParticleSettings.None;
            }

            Width  = w;
            Height = h;
            OrigoX = w / 2;
            OrigoY = h / 2;
        }
示例#4
0
        public DigitEffect(int w, int h, int points)
        {
            Particles          = new MyParticles(w, h, points);
            Particles.Settings = ParticleSettings.None;

            Width  = w;
            Height = h;
            OrigoX = w / 2;
            OrigoY = h / 2;

            if (Width > Height)
            {
                Radius = Convert.ToInt32(Height / 2 * 0.6);
            }
            else
            {
                Radius = Convert.ToInt32(Width / 2 * 0.6);
            }
        }
示例#5
0
        public EvaEffect(int w, int h, int points)
        {
            for (int i = 0; i < Particles.Length; i++)
            {
                Particles[i]          = new MyParticles(w, h, points);
                Particles[i].Settings = ParticleSettings.None;
            }
            Width  = w;
            Height = h;
            OrigoX = w / 2;
            OrigoY = h / 2;

            if (Width > Height)
            {
                Radius = Convert.ToInt32(Height / 2 * 0.6);
            }
            else
            {
                Radius = Convert.ToInt32(Width / 2 * 0.6);
            }
        }
示例#6
0
        public void UpdateDigits(GameTime gameTime)
        {
            TimeSpan span    = fGoalDate - DateTime.Now;
            int      days    = 0;
            int      hours   = 0;
            int      minutes = 0;
            int      seconds = 0;

            if (span.TotalSeconds > 0)
            {
                days    = span.Days;
                hours   = span.Hours;
                minutes = span.Minutes;
                seconds = span.Seconds;
                if (days > 999)
                {
                    days    = 999;
                    hours   = 99;
                    minutes = 99;
                    seconds = 99;
                }
            }
            DigitType colonType = DigitType.colon1;

            if ((seconds % 2) == 1)
            {
                colonType = DigitType.colon2;
            }

            int days1    = days / 100;
            int days2    = (days / 10) % 10;
            int days3    = days % 10;
            int hours1   = hours / 10;
            int hours2   = hours % 10;
            int minutes1 = minutes / 10;
            int minutes2 = minutes % 10;
            int seconds1 = seconds / 10;
            int seconds2 = seconds % 10;

            int index = 0;

            fCurrentDigits[index++] = (DigitType)days1;
            fCurrentDigits[index++] = (DigitType)days2;
            fCurrentDigits[index++] = (DigitType)days3;
            fCurrentDigits[index++] = colonType;
            fCurrentDigits[index++] = (DigitType)hours1;
            fCurrentDigits[index++] = (DigitType)hours2;
            fCurrentDigits[index++] = colonType;
            fCurrentDigits[index++] = (DigitType)minutes1;
            fCurrentDigits[index++] = (DigitType)minutes2;
            fCurrentDigits[index++] = colonType;
            fCurrentDigits[index++] = (DigitType)seconds1;
            fCurrentDigits[index++] = (DigitType)seconds2;

            //int  milliseconds = gameTime.TotalGameTime.Milliseconds;
            //double f = milliseconds / 1000.0f;

            int x0 = SIZE * SEGMENTS_X / 2;

            //int y0 = SIZE * SEGMENTS_X / 2;


            //if ((seconds1%2)==0)
            //{
            //    y0 = Height - SIZE * SEGMENTS_X;
            //}
            for (int digitIndex = 0; digitIndex < fCurrentDigits.Length; digitIndex++)
            {
                int ox = Width / 2 + (SIZE * SEGMENTS_X) * (digitIndex - 6);
                int y0 = SIZE * SEGMENTS_X / 2;
                int ms = gameTime.TotalGameTime.Seconds * 1000 + gameTime.TotalGameTime.Milliseconds + 50 * digitIndex;
                ms = ms % 60000;

                if (ms > 30000)
                {
                    y0 = Height - SIZE * SEGMENTS_X;
                }


                DigitType     dType     = fCurrentDigits[digitIndex];
                MyParticles   particles = fParticles[digitIndex];
                LineConnector connector = GetDigit(dType);

                if (connector != null)
                {
                    var points = connector.DistributePoints(particles.Count, 0);
                    for (int i = 0; i < points.Count; i++)
                    {
                        var particle = particles[i];
                        var point    = points[i];
                        particle.Destination = new Vector2(x0 + ox + point.X, y0 + point.Y);
                    }
                }
            }
        }
示例#7
0
 public MyParticle(MyParticles parent)
 {
     fParent = parent;
     GetNewInnerDestination();
 }