2023-11-30 02:23:07 +04:00
|
|
|
|
namespace ProjectBulldozer.MovementStrategy
|
2023-11-23 01:37:55 +04:00
|
|
|
|
{
|
|
|
|
|
public class MoveToRightCorner : AbstractStrategy
|
|
|
|
|
{
|
|
|
|
|
protected override bool IsTargetDestinaion()
|
|
|
|
|
{
|
|
|
|
|
var objParams = GetObjectParameters;
|
|
|
|
|
if (objParams == null) return false;
|
|
|
|
|
|
|
|
|
|
return objParams.RightBorder >= FieldWidth - GetStep() && objParams.DownBorder >= FieldHeight - GetStep();
|
|
|
|
|
}
|
|
|
|
|
protected override void MoveToTarget()
|
|
|
|
|
{
|
|
|
|
|
var objParams = GetObjectParameters;
|
|
|
|
|
if (objParams == null) return;
|
|
|
|
|
if (objParams.RightBorder < FieldWidth - GetStep()) MoveRight();
|
|
|
|
|
if (objParams.DownBorder < FieldHeight - GetStep()) MoveDown();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|