2019-04-22 09:24:16 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using CzokoŚmieciarka.MonoGameView.DataModels.Exceptions;
|
|
|
|
|
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans;
|
|
|
|
|
using CzokoŚmieciarka.MonoGameView.DataModels.Models;
|
2019-04-22 14:17:44 +02:00
|
|
|
|
using Microsoft.Xna.Framework.Content;
|
2019-04-22 09:24:16 +02:00
|
|
|
|
|
|
|
|
|
namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector
|
|
|
|
|
{
|
|
|
|
|
public abstract class AGarbageCollector : IGarbageCollector, ICloneable
|
|
|
|
|
{
|
2019-04-23 11:24:07 +02:00
|
|
|
|
public AGarbageCollector(Coords startPosition, IEnumerable<AGarbageCollectorContainer> trashContainers, int columns, int rows,int houseCounter,int counter = 0)
|
2019-04-22 09:24:16 +02:00
|
|
|
|
{
|
|
|
|
|
this.columns = columns;
|
|
|
|
|
this.rows = rows;
|
|
|
|
|
this.Coords = startPosition;
|
|
|
|
|
this.TrashContainers = trashContainers;
|
2019-04-23 11:24:07 +02:00
|
|
|
|
this.Counter = counter;
|
|
|
|
|
this.HouseCounter = houseCounter;
|
2019-04-22 09:24:16 +02:00
|
|
|
|
}
|
2019-04-23 11:24:07 +02:00
|
|
|
|
public int Counter { get; set; }
|
|
|
|
|
public int HouseCounter { get; set; }
|
2019-04-22 09:24:16 +02:00
|
|
|
|
public Coords Coords { get; set; }
|
|
|
|
|
public int columns { get; set; }
|
|
|
|
|
public int rows { get; set; }
|
2019-04-23 11:24:07 +02:00
|
|
|
|
public bool MoveUp()
|
2019-04-22 09:24:16 +02:00
|
|
|
|
{
|
|
|
|
|
if(Coords.Y -1 < 0)
|
|
|
|
|
{
|
2019-04-23 11:24:07 +02:00
|
|
|
|
return false;
|
2019-04-22 09:24:16 +02:00
|
|
|
|
}
|
|
|
|
|
Coords.Y -= 1;
|
2019-04-23 11:24:07 +02:00
|
|
|
|
return true;
|
2019-04-22 09:24:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-23 11:24:07 +02:00
|
|
|
|
public bool MoveDown()
|
2019-04-22 09:24:16 +02:00
|
|
|
|
{
|
|
|
|
|
if (Coords.Y + 1 >= rows)
|
|
|
|
|
{
|
2019-04-23 11:24:07 +02:00
|
|
|
|
return false;
|
2019-04-22 09:24:16 +02:00
|
|
|
|
}
|
|
|
|
|
Coords.Y +=1;
|
2019-04-23 11:24:07 +02:00
|
|
|
|
return true;
|
2019-04-22 09:24:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-23 11:24:07 +02:00
|
|
|
|
public bool MoveLeft()
|
2019-04-22 09:24:16 +02:00
|
|
|
|
{
|
|
|
|
|
if (Coords.X - 1 < 0)
|
|
|
|
|
{
|
2019-04-23 11:24:07 +02:00
|
|
|
|
return false;
|
2019-04-22 09:24:16 +02:00
|
|
|
|
}
|
|
|
|
|
Coords.X -= 1;
|
2019-04-23 11:24:07 +02:00
|
|
|
|
return true;
|
2019-04-22 09:24:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-23 11:24:07 +02:00
|
|
|
|
public bool MoveRight()
|
2019-04-22 09:24:16 +02:00
|
|
|
|
{
|
|
|
|
|
if (Coords.X + 1 >= columns)
|
|
|
|
|
{
|
2019-04-23 11:24:07 +02:00
|
|
|
|
return false;
|
2019-04-22 09:24:16 +02:00
|
|
|
|
}
|
|
|
|
|
Coords.X += 1;
|
2019-04-23 11:24:07 +02:00
|
|
|
|
return true;
|
2019-04-22 09:24:16 +02:00
|
|
|
|
}
|
2019-04-23 06:32:35 +02:00
|
|
|
|
|
2019-04-22 09:24:16 +02:00
|
|
|
|
|
2019-05-13 18:15:48 +02:00
|
|
|
|
public IEnumerable<AGarbageCollectorContainer> TrashContainers { get; set; }
|
2019-04-23 06:32:35 +02:00
|
|
|
|
public virtual object Clone()
|
2019-04-22 14:17:44 +02:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2019-04-22 09:24:16 +02:00
|
|
|
|
}
|
|
|
|
|
}
|