2024-05-07 00:47:57 +04:00

65 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WarmlyShip.Entities;
namespace WarmlyShip.Drawnings
{
public class DrawningWarmlyShip : DrawningShip
{
public DrawningWarmlyShip(int speed, double weight, Color bodyColor, Color seckondColor, bool fuelHole, bool pipes) : base(150, 80)
{
EntityShip = new EntityWarmlyShip(speed, weight, bodyColor, seckondColor, fuelHole, pipes);
}
public DrawningWarmlyShip(EntityWarmlyShip ship) : base(150, 80)
{
EntityShip = new EntityWarmlyShip(ship.Speed, ship.Weight, ship.BodyColor, ship.SeckondColor, ship.FuelHole, ship.Pipes);
}
public override void DrawTransport(Graphics g)
{
if (EntityShip == null || !_startPosX.HasValue || !_startPosY.HasValue || EntityShip is not EntityWarmlyShip warmlyShip)
{
return;
}
base.DrawTransport(g);
Pen pen = new(Color.Black, 2);
Brush brMain = new SolidBrush(EntityShip.BodyColor);
Brush brSecond = new SolidBrush(warmlyShip.SeckondColor);
//трубы
if (warmlyShip.Pipes)
{
g.FillRectangle(brSecond, _startPosX.Value + 35, _startPosY.Value, 20, 30);
g.FillRectangle(brSecond, _startPosX.Value + 64, _startPosY.Value, 20, 30);
g.FillRectangle(brSecond, _startPosX.Value + 93, _startPosY.Value, 20, 30);
}
//топливный отсек
if (warmlyShip.FuelHole)
{
g.FillEllipse(brSecond, _startPosX.Value + 100, _startPosY.Value + 55, 15, 15);
g.DrawEllipse(pen, _startPosX.Value + 100, _startPosY.Value + 55, 15, 15);
}
}
}
}