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

38 lines
1.4 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 CollectStep : IStep
{
public CollectStep(ITypeOfGarbage typeOfGarbage)
{
this._typeOfGarbage = typeOfGarbage;
}
private ITypeOfGarbage _typeOfGarbage;
public void Invoke(IGarbageCollector garbageCollector, object [,] grid)
{
/*
if(_garbageCollector.Coords != _garbageLocalization.Coords)
throw new WrongPositionException("Śmieciarka nie jest w miejscu oderbania śmieci");
var trashCans = _garbageLocalization.TrashCans.Where(t => t.TypeOfGarbage == _typeOfGarbage);
var garbage = trashCans.Select(t => t.TakeGarbage()).Aggregate((a,b)=>a+b);
if (_garbageCollector.TrashContainers.All(c => c.TypeOfGarbage != _typeOfGarbage))
throw new TrashContainerNotFound($"Nie znaleziono kontenera na {_typeOfGarbage.GarbageType}.");
_garbageCollector.TrashContainers.First(t => t.TypeOfGarbage == _typeOfGarbage).AddGarbage(garbage);
*/
}
}
}