27 lines
754 B
Java
27 lines
754 B
Java
package ProjectStormtrooper;
|
|
|
|
public class MoveToRightBottom extends AbstractStrategy {
|
|
@Override
|
|
protected void MoveToTarget() {
|
|
var objParams = GetObjectParameters();
|
|
if (objParams == null) {
|
|
return;
|
|
}
|
|
if (objParams.RightBorder() < FieldWidth - GetStep()) {
|
|
MoveRight();
|
|
}
|
|
if (objParams.TopBorder() < FieldHeight - GetStep()) {
|
|
MoveDown();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
protected boolean IsTargetDestination() {
|
|
var objParams = GetObjectParameters();
|
|
if (objParams == null) {
|
|
return false;
|
|
}
|
|
return objParams.RightBorder() >= FieldWidth - GetStep() && objParams.DownBorder() >= FieldHeight - GetStep();
|
|
}
|
|
}
|