Czoko_Smieciarka/Trunk/MonoGameView/DataModels/Interfaces/Garbage/AGarbage.cs

49 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.Garbage
{
public abstract class AGarbage : IGarbage
{
protected AGarbage(ITypeOfGarbage typeOfGarbage, int weight)
{
this.TypeOfGarbage = typeOfGarbage;
this.Weight = weight;
}
public ITypeOfGarbage TypeOfGarbage { get; }
public virtual int Weight { get; set; }
public virtual int Volume
{
get { return this.Weight / TypeOfGarbage.Density; }
}
protected abstract AGarbage Add(AGarbage garbageToAdd);
protected abstract AGarbage Subtract (AGarbage garbageToSubtract);
#region Operators
public static AGarbage operator + (AGarbage a, AGarbage b)
{
return a.Add(b);
}
public static AGarbage operator - (AGarbage a, AGarbage b)
{
return a.Subtract(b);
}
#endregion
public object Clone()
{
return this.MemberwiseClone();
}
}
}