public FormationPattern<Vector2> getFormationPattern (FormationPatternType pattern) { switch (pattern) { case Line: return new LineFormationPattern(Constants.unitRadius + PATTERN_SPACING); case Column: return new ColumnFormationPattern(Constants.unitRadius + PATTERN_SPACING); case Square: return new SquareFormationPattern(Constants.unitRadius + PATTERN_SPACING); default: case Ring: return new OffensiveCircleFormationPattern<Vector2>(Constants.unitRadius + PATTERN_SPACING); case V: return new VFormationPattern(60 * MathUtils.degreesToRadians, Constants.unitRadius + PATTERN_SPACING); case Wedge: return new WedgeFormationPattern(Constants.unitRadius + PATTERN_SPACING); } }
public void setFormationPattern (FormationPatternType pattern) { FormationPattern<Vector2> formationPattern = getFormationPattern(pattern); formation.changePattern(formationPattern); }