Пример #1
0
        public Sprite[][] DrawHexagon()
        {
            double size = 15;
            double width = 1366 * Control.scale;

            int cx = 320;
            int cy = 320;
            double radius = size / 2;
            double scale = size / 100.0;
            double percentagex = 1;
            double percentagey = 1;
            double intervalx = radius * Math.Cos(30.0 * (Math.PI / 180.0)) * percentagex;
            double intervaly = 2 * ((radius) * Math.Sin(30.0 * (Math.PI / 180.0))) + size * percentagey;
            int amountx = (int)((width) / intervalx) + 5;

            Sprite[][] hexagons = new Sprite[amountx][];
            for (int i = 0; i < hexagons.Length; i++)
            {
                double t = Math.Abs(i - amountx / 2) * (10 / width);
                double height = Math.Pow(t, 2) * 400;
                int amounty = (int)((height) / intervaly) + 5;

                hexagons[i] = new Sprite[amounty];
                for (int j = 0; j < hexagons[i].Length; j++)
                {

                    Sprite hexagon = new Sprite(@"sb\etc\hexagon.png", Sprite.layer.Background);
                    if (i < amountx / 2)
                    {
                        hexagon.MoveX((int)(cx - (intervalx * (amountx / 2 - i))));
                    } else
                    {
                        hexagon.MoveX((int)(cx + (intervalx * (i - amountx / 2))));
                    }

                    if (i % 2 == 0)
                    {
                        if (j < amounty / 2)
                        {
                            hexagon.MoveY((int)(cy - (intervaly * (amounty / 2 - j))));
                        }
                        else
                        {
                            hexagon.MoveY((int)(cy + (intervaly * (j - amounty / 2))));
                        }
                    }
                    else
                    {
                        if (j < amounty / 2)
                        {
                            hexagon.MoveY((int)(cy - (intervaly * (amounty / 2 - j)) + (radius + (radius * Math.Sin(30.0 * (Math.PI / 180.0))))));
                        }
                        else
                        {
                            hexagon.MoveY((int)(cy + (intervaly * (j - amounty / 2)) + (radius + (radius * Math.Sin(30.0 * (Math.PI / 180.0))))));
                        }
                    }
                    hexagon.Scale(scale);
                    hexagon.Parameters(0, 0, "A");
                    hexagon.Fade(0);
                    Color2 h = Color2.HSL2RGB((double)i / hexagons.Length, .7, .4);
                    hexagon.Color(h.red, h.green, h.blue);
                    hexagons[i][j] = hexagon;
                }
            }
            return hexagons;
        }
Пример #2
0
 public void Flash(int startTime)
 {
     Sprite white = new Sprite(@"sb\etc\p.png", Sprite.origin.BottomCentre);
     white.Fade(startTime, startTime + beat / 2, .7, 0);
     white.Scale(startTime, scale);
     white.Move(startTime, 320, 480);
     Color2 c = Color2.HSL2RGB(rand.Next(1, 100) / 100.0, .4, .8);
     white.Color(startTime, c.red, c.green, c.blue);
     white.Parameters(startTime, startTime, "A");
 }
Пример #3
0
        public void ShootingStar(double startTime, int x, int dir)
        {
            int midPoint = rand.Next(230, 260);
            Sprite star = new Sprite(@"sb\bg\star.png");
            star.Scale(.1);
            star.Rotate(startTime, startTime + beat * 2, 0, rand.Next(60, 180));
            star.Move(1, startTime, startTime + beat / 4 * 3, x, -20, x, 500);
            star.Fade(startTime - 1, startTime, 0, 1);
            star.Parameters(startTime, startTime, "A");
            star.Color(247, 255, 168);

            Sprite line = Mathematics.DrawLines(startTime, 500, 10, dir == 1 ? Sprite.origin.CentreRight : Sprite.origin.CentreLeft);
            line.Rotate(startTime, 90 * dir);
            line.Move(1, startTime, startTime + beat / 4 * 3, x, -20, x, 500);
            Mathematics.ScaleLines(line, 1, startTime + beat, startTime + beat / 4 * 7, 1, 10);
            line.Parameters(startTime, startTime, "A");
            line.Color(247, 255, 168);
            line.Fade(startTime - 1, startTime, 0, 1);
        }