private static IEnumerator<bool> BlinkFunction(MultiAdditionalCoroutineSprite sp, int time, double duraiton, EasingFunction easing) { while (true) { for (int i = 0; i < time; i++) { sp.Alpha = easing(i, time, 1, -duraiton); yield return true; } } }
private static IEnumerator<bool> AlphaFunction(MultiAdditionalCoroutineSprite sp, int time, double alpha, EasingFunction easing) { var sa = sp.Alpha; for (int i = 0; i < time; i++) { sp.Alpha = easing(i, time, sa, alpha - sa); yield return true; } sp.Alpha = alpha; }
private static IEnumerator<bool> CursorMoveFunction(MultiAdditionalCoroutineSprite sp, int time, double x, double y, EasingFunction easing) { var sy = sp.Y; var sx = sp.X; for (int i = 0; i < time; i++) { sp.Y = easing(i, time, sy, y - sy); sp.X = easing(i, time, sx, x - sx); yield return true; } sp.Y = y; sp.X = x; }
private static IEnumerator<bool> VerticalFadeOutFunction(MultiAdditionalCoroutineSprite sp, int time, double moving, EasingFunction moveEasing, EasingFunction fadeEasing) { var sa = sp.Alpha; var sy = sp.Y; for (int i = 0; i < time; i++) { sp.Alpha = fadeEasing(i, time, sa, -sa); sp.Y = moveEasing(i, time, sy, moving); yield return true; } sp.IsDead = true; }
private static IEnumerator<bool> MenuOutroFunction(MultiAdditionalCoroutineSprite sp, int delay, int time, double ty) { for (int i = 0; i < delay; i++) yield return true; var sy = sp.Y; for (int i = 0; i < time; i++) { sp.Y = Easing.OutSine(i, time, sy, ty - sy); yield return true; } sp.Y = ty; }
private static IEnumerator<bool> LaserThrowAwayFunction(MultiAdditionalCoroutineSprite sp, double angle, double speed) { while (true) { sp.X += Math.Cos(angle) * speed; sp.Y += Math.Sin(angle) * speed; yield return true; } }