Czoko_Smieciarka/Trunk/MonoGameView/DataModels/Models/Steps/MoveStep.cs

37 lines
1.3 KiB
C#
Raw Normal View History

2019-03-13 15:31:33 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CzokoŚmieciarka.MonoGameView.DataModels.Enums;
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces;
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector;
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans;
2019-03-13 15:31:33 +01:00
namespace CzokoŚmieciarka.MonoGameView.DataModels.Models.Steps
2019-03-13 15:31:33 +01:00
{
public class MoveStep : IStep
{
2019-04-22 03:16:30 +02:00
public MoveStep(Direction direction)
2019-03-13 15:31:33 +01:00
{
this._direction = direction;
}
private Direction _direction;
private IGarbageCollector _garbageCollector;
2019-04-22 03:16:30 +02:00
public void Invoke(IGarbageCollector _garbageCollector, object[,] grid)
2019-03-13 15:31:33 +01:00
{
if(grid[_garbageCollector.Coords.X, _garbageCollector.Coords.Y] is Road1)
2019-04-22 03:16:30 +02:00
grid[_garbageCollector.Coords.X, _garbageCollector.Coords.Y] = new Road2();
2019-03-13 15:31:33 +01:00
switch (_direction)
{
case Direction.Up: _garbageCollector.MoveUp(); break;
case Direction.Down: _garbageCollector.MoveDown(); break;
case Direction.Left: _garbageCollector.MoveLeft(); break;
case Direction.Right: _garbageCollector.MoveRight(); break;
}
}
}
}