43 lines
2.2 KiB
C#
43 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models;
|
|
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces;
|
|
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Content;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using MonoGameView.DataModels.Models;
|
|
|
|
namespace CzokoŚmieciarka.MonoGameView.DataModels.Models
|
|
{
|
|
public class House : IDrawables, IGarbageLocalization, ICloneable
|
|
{
|
|
public Coords Coords { get; }
|
|
|
|
public House(Coords coords, IEnumerable<TrashCan> trashCans)
|
|
{
|
|
Coords = coords;
|
|
TrashCans = trashCans;
|
|
}
|
|
public void Draw(SpriteBatch batch, int size)
|
|
{
|
|
batch.Draw(ImageContainer.GetImage("house"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White);
|
|
batch.Draw(ImageContainer.GetImage("GlassBar"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, (int)Math.Round(TrashCans.ElementAtOrDefault(0).FillPercent*500) / size, 50 / size), Color.White);
|
|
batch.Draw(ImageContainer.GetImage("PaperBar"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size + 5, (int)Math.Round(TrashCans.ElementAtOrDefault(1).FillPercent * 500) / size, 50 / size), Color.White);
|
|
batch.Draw(ImageContainer.GetImage("PlasticMetalBar"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size + 10, (int)Math.Round(TrashCans.ElementAtOrDefault(2).FillPercent * 500) / size, 50 / size), Color.White);
|
|
batch.Draw(ImageContainer.GetImage("OrganicBar"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size + 15, (int)Math.Round(TrashCans.ElementAtOrDefault(3).FillPercent * 500) / size, 50 / size), Color.White);
|
|
|
|
}
|
|
|
|
public object Clone()
|
|
{
|
|
return new House((Coords) Coords.Clone(), TrashCans.Select(x => (TrashCan) x.Clone()).ToList());
|
|
}
|
|
|
|
public IEnumerable<ATrashCan> TrashCans { get; set; }
|
|
}
|
|
}
|