toVector2 method

Vector2 toVector2()

Implementation

Vector2 toVector2() {
  switch (this) {
    case Direction.left:
      return Vector2(-1, 0);
    case Direction.right:
      return Vector2(1, 0);
    case Direction.up:
      return Vector2(0, -1);
    case Direction.down:
      return Vector2(0, 1);
    case Direction.upLeft:
      return Vector2(-1, -1);
    case Direction.upRight:
      return Vector2(1, -1);
    case Direction.downLeft:
      return Vector2(-1, 1);
    case Direction.downRight:
      return Vector2(1, 1);
  }
}