77 lines
2.1 KiB
C#
77 lines
2.1 KiB
C#
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;
|
|
using Microsoft.Xna.Framework.Content;
|
|
|
|
namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector
|
|
{
|
|
public abstract class AGarbageCollector : IGarbageCollector, ICloneable
|
|
{
|
|
public AGarbageCollector(Coords startPosition, IEnumerable<AGarbageCollectorContainer> trashContainers, int columns, int rows,int houseCounter,int counter = 0)
|
|
{
|
|
this.columns = columns;
|
|
this.rows = rows;
|
|
this.Coords = startPosition;
|
|
this.TrashContainers = trashContainers;
|
|
this.Counter = counter;
|
|
this.HouseCounter = houseCounter;
|
|
}
|
|
public int Counter { get; set; }
|
|
public int HouseCounter { get; set; }
|
|
public Coords Coords { get; set; }
|
|
public int columns { get; set; }
|
|
public int rows { get; set; }
|
|
public bool MoveUp()
|
|
{
|
|
if(Coords.Y -1 < 0)
|
|
{
|
|
return false;
|
|
}
|
|
Coords.Y -= 1;
|
|
return true;
|
|
}
|
|
|
|
public bool MoveDown()
|
|
{
|
|
if (Coords.Y + 1 >= rows)
|
|
{
|
|
return false;
|
|
}
|
|
Coords.Y +=1;
|
|
return true;
|
|
}
|
|
|
|
public bool MoveLeft()
|
|
{
|
|
if (Coords.X - 1 < 0)
|
|
{
|
|
return false;
|
|
}
|
|
Coords.X -= 1;
|
|
return true;
|
|
}
|
|
|
|
public bool MoveRight()
|
|
{
|
|
if (Coords.X + 1 >= columns)
|
|
{
|
|
return false;
|
|
}
|
|
Coords.X += 1;
|
|
return true;
|
|
}
|
|
|
|
|
|
public IEnumerable<AGarbageCollectorContainer> TrashContainers { get; }
|
|
public virtual object Clone()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|