Лабораторная работа №3
This commit is contained in:
parent
65c79eb884
commit
f184b9cdc6
@ -6,50 +6,7 @@ namespace ProjectDumpTrack.Drawnings;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawningDumpTrack : DrawningTrack
|
public class DrawningDumpTrack : DrawningTrack
|
||||||
{
|
{
|
||||||
////2 задание
|
|
||||||
//public override bool MoveTransport(DirectionType direction)
|
|
||||||
//{
|
|
||||||
// if (EntityTrack == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
||||||
// {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// switch (direction)
|
|
||||||
// {
|
|
||||||
// //влево
|
|
||||||
// case DirectionType.Left:
|
|
||||||
// if (_startPosX.Value - EntityTrack.Step > 0)
|
|
||||||
// {
|
|
||||||
// _startPosX -= (int)EntityTrack.Step;
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
// //вверх
|
|
||||||
// case DirectionType.Up:
|
|
||||||
// if (_startPosY.Value - EntityTrack.Step > 0)
|
|
||||||
// {
|
|
||||||
// _startPosY -= (int)EntityTrack.Step;
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
// //вправо
|
|
||||||
// case DirectionType.Right:
|
|
||||||
// if (_startPosX.Value + EntityTrack.Step + _drawningTrackWidth < _pictureWidth)
|
|
||||||
// {
|
|
||||||
// _startPosX += (int)EntityTrack.Step;
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
// //вниз
|
|
||||||
// case DirectionType.Down:
|
|
||||||
// if (_startPosY.Value + EntityTrack.Step + _drawningTrackHeight < _pictureHeight)
|
|
||||||
// {
|
|
||||||
// _startPosY += (int)EntityTrack.Step;
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// default:
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
@ -6,8 +6,7 @@ namespace ProjectDumpTruck.MovementStrategy;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class AbstractStrategy
|
public abstract class AbstractStrategy
|
||||||
{
|
{
|
||||||
////Абстрактный метод 3 задание
|
|
||||||
//public abstract void MyAbstractMethod();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Перемещаемый объект
|
/// Перемещаемый объект
|
||||||
|
@ -23,6 +23,5 @@ public interface IMoveableObject
|
|||||||
/// <returns>true - объект перемещен, false - перемещение невозможно</returns>
|
/// <returns>true - объект перемещен, false - перемещение невозможно</returns>
|
||||||
bool TryMoveObject(MovementDirection direction);
|
bool TryMoveObject(MovementDirection direction);
|
||||||
|
|
||||||
////Интерфейс - задание 1
|
|
||||||
//void MyMethod();
|
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,7 @@ namespace ProjectDumpTruck.MovementStrategy;
|
|||||||
|
|
||||||
public class MoveToBorder : AbstractStrategy
|
public class MoveToBorder : AbstractStrategy
|
||||||
{
|
{
|
||||||
////Абстрактный метод 3 задание
|
|
||||||
//public override void MyAbstractMethod()
|
|
||||||
//{
|
|
||||||
// Console.WriteLine("Implementation of abstract method in derived class");
|
|
||||||
//}
|
|
||||||
protected override bool IsTargetDestinaion()
|
protected override bool IsTargetDestinaion()
|
||||||
{
|
{
|
||||||
ObjectParameters? objParams = GetObjectParameters;
|
ObjectParameters? objParams = GetObjectParameters;
|
||||||
|
@ -6,11 +6,7 @@ namespace ProjectDumpTruck.MovementStrategy;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MoveToCenter : AbstractStrategy
|
public class MoveToCenter : AbstractStrategy
|
||||||
{
|
{
|
||||||
////Абстрактный метод 3 задание
|
|
||||||
//public override void MyAbstractMethod()
|
|
||||||
//{
|
|
||||||
// Console.WriteLine("Implementation of abstract method in derived class");
|
|
||||||
//}
|
|
||||||
protected override bool IsTargetDestinaion()
|
protected override bool IsTargetDestinaion()
|
||||||
{
|
{
|
||||||
ObjectParameters? objParams = GetObjectParameters;
|
ObjectParameters? objParams = GetObjectParameters;
|
||||||
|
@ -8,11 +8,7 @@ namespace ProjectDumpTruck.MovementStrategy;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MoveableTrack : IMoveableObject
|
public class MoveableTrack : IMoveableObject
|
||||||
{
|
{
|
||||||
////Интерфейс-задание 1
|
|
||||||
//public void MyMethod()
|
|
||||||
//{
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,13 +17,7 @@ namespace ProjectDumpTruck
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
////Àáñòðàêòíûé ìåòîä 3 çàäàíèå
|
|
||||||
//AbstractStrategy myObject1 = new MoveToBorder();
|
|
||||||
//myObject1.MyAbstractMethod();
|
|
||||||
|
|
||||||
//AbstractStrategy myObject2 = new MoveToCenter();
|
|
||||||
//myObject2.MyAbstractMethod();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user