Лабораторная работа №3

This commit is contained in:
Esenia12 2024-03-03 23:15:54 +04:00
parent 65c79eb884
commit f184b9cdc6
7 changed files with 7 additions and 70 deletions

View File

@ -6,50 +6,7 @@ namespace ProjectDumpTrack.Drawnings;
/// </summary>
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;
// }
//}

View File

@ -6,8 +6,7 @@ namespace ProjectDumpTruck.MovementStrategy;
/// </summary>
public abstract class AbstractStrategy
{
////Абстрактный метод 3 задание
//public abstract void MyAbstractMethod();
/// <summary>
/// Перемещаемый объект

View File

@ -23,6 +23,5 @@ public interface IMoveableObject
/// <returns>true - объект перемещен, false - перемещение невозможно</returns>
bool TryMoveObject(MovementDirection direction);
////Интерфейс - задание 1
//void MyMethod();
}

View File

@ -3,11 +3,7 @@ namespace ProjectDumpTruck.MovementStrategy;
public class MoveToBorder : AbstractStrategy
{
////Абстрактный метод 3 задание
//public override void MyAbstractMethod()
//{
// Console.WriteLine("Implementation of abstract method in derived class");
//}
protected override bool IsTargetDestinaion()
{
ObjectParameters? objParams = GetObjectParameters;

View File

@ -6,11 +6,7 @@ namespace ProjectDumpTruck.MovementStrategy;
/// </summary>
public class MoveToCenter : AbstractStrategy
{
////Абстрактный метод 3 задание
//public override void MyAbstractMethod()
//{
// Console.WriteLine("Implementation of abstract method in derived class");
//}
protected override bool IsTargetDestinaion()
{
ObjectParameters? objParams = GetObjectParameters;

View File

@ -8,11 +8,7 @@ namespace ProjectDumpTruck.MovementStrategy;
/// </summary>
public class MoveableTrack : IMoveableObject
{
////Интерфейс-задание 1
//public void MyMethod()
//{
//}

View File

@ -17,13 +17,7 @@ namespace ProjectDumpTruck
////Àáñòðàêòíûé ìåòîä 3 çàäàíèå
//AbstractStrategy myObject1 = new MoveToBorder();
//myObject1.MyAbstractMethod();
//AbstractStrategy myObject2 = new MoveToCenter();
//myObject2.MyAbstractMethod();
}
}
}