Czoko_Smieciarka/Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs

77 lines
2.1 KiB
C#
Raw Normal View History

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;
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)
{
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-23 11:24:07 +02:00
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; }
2019-04-23 11:24:07 +02:00
public bool MoveUp()
{
if(Coords.Y -1 < 0)
{
2019-04-23 11:24:07 +02:00
return false;
}
Coords.Y -= 1;
2019-04-23 11:24:07 +02:00
return true;
}
2019-04-23 11:24:07 +02:00
public bool MoveDown()
{
if (Coords.Y + 1 >= rows)
{
2019-04-23 11:24:07 +02:00
return false;
}
Coords.Y +=1;
2019-04-23 11:24:07 +02:00
return true;
}
2019-04-23 11:24:07 +02:00
public bool MoveLeft()
{
if (Coords.X - 1 < 0)
{
2019-04-23 11:24:07 +02:00
return false;
}
Coords.X -= 1;
2019-04-23 11:24:07 +02:00
return true;
}
2019-04-23 11:24:07 +02:00
public bool MoveRight()
{
if (Coords.X + 1 >= columns)
{
2019-04-23 11:24:07 +02:00
return false;
}
Coords.X += 1;
2019-04-23 11:24:07 +02:00
return true;
}
2019-04-23 06:32:35 +02:00
public IEnumerable<AGarbageCollectorContainer> TrashContainers { get; }
2019-04-23 06:32:35 +02:00
public virtual object Clone()
2019-04-22 14:17:44 +02:00
{
throw new NotImplementedException();
}
}
}