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); } } }
private void SetCharacterData(int characterIndex, int characterType) { var particles = Particles[characterIndex]; LineConnector connector = GetConnector(characterType); 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]; int position = 2 * Radius * i / particles.Count - Radius; particle.Destination = new Vector2(point.X, point.Y); } } }
public void DigitUpdate(GameTime gameTime) { int milliseconds = gameTime.ElapsedGameTime.Milliseconds; int second = gameTime.TotalGameTime.Seconds; int digit = second % 10; bool rotate = true; if (rotate) { LineConnector connector = GetDigit(digit); if (connector != null) { double f = gameTime.TotalGameTime.Milliseconds / 1000.0f; //double f = (gameTime.TotalGameTime.Seconds % 10) / 10.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(OrigoX + point.X, OrigoY + point.Y); } } } else if (second != fLastSecond) { LineConnector connector = GetDigit(digit); if (connector != null) { var points = connector.DistributePoints(Particles.Count, 0.0f); 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(OrigoX + point.X, OrigoY + point.Y); } } } }
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); } } } }