private void moveToTarget() { float sine = (float)Math.Sin(sineWave) * 4f; Vector2 displacement = Calc.YoYo(Ease.QuadIn(dashEase)) * dashDirection * 8f; for (int i = 0; i < 2; i++) { foreach (KeyValuePair <Platform, Vector2> move in moves) { Platform platform = move.Key; bool hasPlayer = false; JumpThru jumpThru = platform as JumpThru; Solid solid = platform as Solid; if ((jumpThru != null && jumpThru.HasRider()) || (solid?.HasRider() ?? false)) { hasPlayer = true; } if ((hasPlayer || i != 0) && (!hasPlayer || i != 1)) { Vector2 value = move.Value; float yMove = MathHelper.Lerp(value.Y, value.Y + 12f, Ease.SineInOut(yLerp)) + sine; platform.MoveToY(yMove + displacement.Y); platform.MoveToX(value.X + displacement.X); } } } }
private void MoveToTarget() { float sine = (float)Math.Sin(sineWave) * 4f; Vector2 vector = Calc.YoYo(Ease.QuadIn(dashEase)) * dashDirection * 8f; for (int i = 0; i < 2; i++) { foreach (KeyValuePair <Platform, Vector2> keyValuePair in Moves) { Platform key = keyValuePair.Key; bool hasRider = false; JumpThru jumpThru = key as JumpThru; Solid solid = key as Solid; if ((jumpThru != null && jumpThru.HasRider()) || (solid != null && solid.HasRider())) { hasRider = true; } if ((hasRider || i != 0) && (!hasRider || i != 1)) { Vector2 value = keyValuePair.Value; float num2 = MathHelper.Lerp(value.Y, value.Y + 12f, Ease.SineInOut(yLerp)) + sine; key.MoveToY(num2 + vector.Y); key.MoveToX(value.X + vector.X); } } } }