40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces;
|
|
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector;
|
|
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans;
|
|
|
|
namespace CzokoŚmieciarka.MonoGameView.DataModels.Models.Steps
|
|
{
|
|
public class SpillStep : IStep
|
|
{
|
|
public SpillStep(ITypeOfGarbage typeOfGarbage)
|
|
{
|
|
this._typeOfGarbage = typeOfGarbage;
|
|
}
|
|
|
|
private ITypeOfGarbage _typeOfGarbage;
|
|
|
|
public void Invoke(IGarbageCollector garbageCollector, object [,] grid)
|
|
{/*
|
|
if(_garbageCollector.Coords != _dump.Coords)
|
|
throw new WrongPositionException("Śmieciarka nie na terenie podanego wyspiska");
|
|
|
|
if(_dump.TypeOfGarbage != _typeOfGarbage)
|
|
throw new TrashContainerNotFound($"Wysypisko nie przyjmuje smieci typu {_typeOfGarbage.GarbageType}");
|
|
|
|
if(_garbageCollector.TrashContainers.All(c => c.TypeOfGarbage != _typeOfGarbage))
|
|
throw new TrashContainerNotFound($"Smieciarka nie ma pojemnika na {_typeOfGarbage.GarbageType}!");
|
|
|
|
var garbage = _garbageCollector.TrashContainers.Where(t => t.TypeOfGarbage == _typeOfGarbage)
|
|
.Select(t => t.TakeGarbage())
|
|
.Aggregate((a, b) => a + b);
|
|
|
|
_dump.AddGarbage(garbage);*/
|
|
}
|
|
}
|
|
}
|