chore: var names and lambda method for identity element

pull/14/head
RuiAlonso 3 years ago
parent d6f7bb853d
commit 8901bcec70

@ -32,7 +32,7 @@ class Path extends BodyComponent {
required Vector2 end, required Vector2 end,
required double pathWidth, required double pathWidth,
double rotation = 0, double rotation = 0,
bool onlyOneWall = false, bool singleWall = false,
}) { }) {
final paths = <List<Vector2>>[]; final paths = <List<Vector2>>[];
final wall1 = [ final wall1 = [
@ -41,7 +41,7 @@ class Path extends BodyComponent {
]; ];
paths.add(wall1.map((e) => e..rotate(radians(rotation))).toList()); paths.add(wall1.map((e) => e..rotate(radians(rotation))).toList());
if (!onlyOneWall) { if (!singleWall) {
final wall2 = [ final wall2 = [
start + Vector2(pathWidth, 0), start + Vector2(pathWidth, 0),
end + Vector2(pathWidth, 0), end + Vector2(pathWidth, 0),
@ -72,7 +72,7 @@ class Path extends BodyComponent {
required double radius, required double radius,
required double angle, required double angle,
double rotation = 0, double rotation = 0,
bool onlyOneWall = false, bool singleWall = false,
}) { }) {
final paths = <List<Vector2>>[]; final paths = <List<Vector2>>[];
@ -84,7 +84,7 @@ class Path extends BodyComponent {
); );
paths.add(wall1); paths.add(wall1);
if (!onlyOneWall) { if (!singleWall) {
final minRadius = radius - pathWidth; final minRadius = radius - pathWidth;
final wall2 = calculateArc( final wall2 = calculateArc(
@ -117,7 +117,7 @@ class Path extends BodyComponent {
required List<Vector2> controlPoints, required List<Vector2> controlPoints,
required double pathWidth, required double pathWidth,
double rotation = 0, double rotation = 0,
bool onlyOneWall = false, bool singleWall = false,
}) { }) {
final paths = <List<Vector2>>[]; final paths = <List<Vector2>>[];
@ -125,7 +125,7 @@ class Path extends BodyComponent {
paths.add(wall1.map((e) => e..rotate(radians(rotation))).toList()); paths.add(wall1.map((e) => e..rotate(radians(rotation))).toList());
var wall2 = <Vector2>[]; var wall2 = <Vector2>[];
if (!onlyOneWall) { if (!singleWall) {
wall2 = calculateBezierCurve( wall2 = calculateBezierCurve(
controlPoints: controlPoints controlPoints: controlPoints
.map((e) => e + Vector2(pathWidth, -pathWidth)) .map((e) => e + Vector2(pathWidth, -pathWidth))
@ -155,7 +155,7 @@ class Path extends BodyComponent {
for (final path in _paths) { for (final path in _paths) {
final chain = ChainShape() final chain = ChainShape()
..createChain( ..createChain(
path.map((e) => gameRef.screenToWorld(e)).toList(), path.map(gameRef.screenToWorld).toList(),
); );
final fixtureDef = FixtureDef(chain); final fixtureDef = FixtureDef(chain);
body.createFixture(fixtureDef); body.createFixture(fixtureDef);

Loading…
Cancel
Save