public SimulatedDisplacement(UnitDisplacement displacement) { this.displacement = displacement; this.result = displacement.GetTargetCoordinate(); this.current = displacement.GetStartCoordinate(); this.conflict = false; this.outOfBounds = false; }
public Vector2 GetPreviousSimulationStep(Board board) { if (displacement.type == UnitDisplacementType.RELATIVE && !CheckCoordinateEquality(current, displacement.GetStartCoordinate())) { RelativeDisplacement rd = (RelativeDisplacement)displacement; Vector2 prev = current - rd.GetUnitStep(); if (board.CheckCoord(new Vector2(Mathf.Round(prev.x), Mathf.Round(prev.y)))) { current = prev; } else { outOfBounds = true; } } else if (displacement.type == UnitDisplacementType.ABSOLUTE) { current = displacement.GetStartCoordinate(); } return(GetCurrentVector()); }