PIbd-21_Potapov_N.S._Stormt.../ProjectStormtrooper/MoveToRightBottom.java

27 lines
754 B
Java
Raw Normal View History

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();
}
}