Exemplo n.º 1
0
        private void OnGameplayStateEnter()
        {
            isActive = true;

            currentMultiplier = 0;
            currentDistanceForMultiplierBump = 0f;

            UpdateSequence(true);

            currentPlayTime = 0f;
            UpdateDifficulty();

            currentAngleSwapDistance = 0f;
            angleDirection           = (AngleDirection)Random.Range(0, Enum.GetValues(typeof(AngleDirection)).Length);

            SwapAngle();
        }
Exemplo n.º 2
0
        // produce points on a circle
        // circle: (x, y, r)
        // number of points: num
        // return value: px, py
        //
        public static void CircleToPoints(double x, double y, double r,
                                          int num, double[] px, double[] py, AngleDirection dir)
        {
            double a = 0;

            for (int i = 0; i < num; ++i)
            {
                if (dir == AngleDirection.CounterClockwise)
                {
                    a = 2.0 * Math.PI * i / num;
                }
                else
                {
                    a = 2.0 * Math.PI * (1.0 - (double)i / (double)num);
                }
                px[i] = x + r * Math.Cos(a);
                py[i] = y + r * Math.Sin(a);
            }
        }
Exemplo n.º 3
0
 // produce points on a circle
 // circle: (x, y, r)
 // number of points: num
 // return value: px, py
 //
 public static void CircleToPoints(double x, double y, double r,
     int num, double[] px, double[] py, AngleDirection dir)
 {
     double a = 0;
     for (int i = 0; i < num; ++i)
     {
         if (dir == AngleDirection.CounterClockwise)
             a = 2.0 * Math.PI * i / num;
         else
             a = 2.0 * Math.PI * (1.0 - (double)i / (double)num);
         px[i] = x + r * Math.Cos(a);
         py[i] = y + r * Math.Sin(a);
     }
 }
Exemplo n.º 4
0
        public Vector2 AddArc(string name, Vector2 start, Vector2 end, Vector2 center, AngleDirection orientation = AngleDirection.CCW)
        {
            var radius = Math.Min(Math.Abs((start - center).Modulus()), Math.Abs((end - center).Modulus()));

            double startAngle = orientation == AngleDirection.CCW? Vector2.Angle(start - center).ToDegree() : Vector2.Angle(end - center).ToDegree();
            double endAngle   = orientation == AngleDirection.CCW ? Vector2.Angle(end - center).ToDegree() : Vector2.Angle(start - center).ToDegree();

            var arc = new Arc(center, radius, startAngle, endAngle)
            {
                Comment = name
            };

            Arcs.Add(arc);
            return(end);
        }
Exemplo n.º 5
0
 static (double, double) Orient(double start, double end, AngleDirection dir)
 => dir switch
Exemplo n.º 6
0
 private void SwapAngle()
 {
     requiredAngleSwapDistance = Random.Range(minDistanceUntilAngleSwap, maxDistanceUntilAngleSwap);
     angleDirection            = angleDirection == AngleDirection.Left ? AngleDirection.Right : AngleDirection.Left;
 }