Code smells
This commit is contained in:
23
PathFinding/MoveSet.cs
Normal file
23
PathFinding/MoveSet.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace PathFinding
|
||||
{
|
||||
public class MoveSet
|
||||
{
|
||||
private readonly IPlanarElement element;
|
||||
private readonly ICollection<Move> moves;
|
||||
private readonly ICollection<Move> upsidedownMoves;
|
||||
|
||||
public MoveSet(IPlanarElement element, ICollection<Move> moves)
|
||||
{
|
||||
this.element = element;
|
||||
this.moves = moves;
|
||||
upsidedownMoves = moves.Select(_ => new Move(Vector2.Negate(_.Direction), _.Distance)).ToList();
|
||||
}
|
||||
|
||||
public ICollection<Move> GetMoves() => element.IsUpsideDown ? upsidedownMoves : moves;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user