コード例 #1
0
ファイル: StreakTracker.cs プロジェクト: Etny/Flagr
        private void UpdatePointer(DeltaTime deltaTime)
        {
            float target        = targets[CurrentStreak] + (rng.Next(0, wiggle[CurrentStreak]) - wiggle[CurrentStreak] / 2);
            float rotationSpeed = speeds[CurrentStreak];

            if (rotation != target)
            {
                float dif  = target - rotation;
                float move = (rotationSpeed * deltaTime.Seconds);

                if (Util.AbsoluteFloat(dif) < Util.AbsoluteFloat(move))
                {
                    move = Util.AbsoluteFloat(dif);
                }

                if (dif < 0)
                {
                    move *= -1;
                }

                rotation += move;
            }

            endPoint.X = centerPoint.X + (int)(radius * Math.Cos(Util.DegreeToRadian(rotation + 90)));
            endPoint.Y = centerPoint.Y + (int)(radius * Math.Sin(Util.DegreeToRadian(rotation + 90)));
        }