„Беды приходят тогда, когда люди в своей лени забывают заботиться о себе.“

This commit is contained in:
antoc0der 2023-11-07 21:16:17 +03:00
parent 080c6c4c23
commit e86d1515d9
6 changed files with 27 additions and 5 deletions

View File

@ -54,6 +54,12 @@ namespace ProjectAirplaneWithRadar.DrawningObjects
_startPosX = x; _startPosX = x;
_startPosY = y; _startPosY = y;
} }
public void ChangeColor(Color col)
{
if (EntityAirplane == null)
return;
EntityAirplane.BodyColor = col;
}
public bool CanMove(Direction direction) public bool CanMove(Direction direction)
{ {
if (EntityAirplane == null) if (EntityAirplane == null)

View File

@ -20,6 +20,10 @@ namespace ProjectAirplaneWithRadar.DrawningObjects
EntityAirplane = new EntityAirplaneWithRadar(speed, weight, bodyColor, additionalColor, radar, dopbak); EntityAirplane = new EntityAirplaneWithRadar(speed, weight, bodyColor, additionalColor, radar, dopbak);
} }
} }
public void ChangeAddColor(Color col)
{
((EntityAirplaneWithRadar)EntityAirplane).AdditionalColor = col;
}
public override void DrawTransport(Graphics g) public override void DrawTransport(Graphics g)
{ {
if (EntityAirplane is not EntityAirplaneWithRadar airplaneWithRadar) if (EntityAirplane is not EntityAirplaneWithRadar airplaneWithRadar)

View File

@ -11,7 +11,7 @@ namespace ProjectAirplaneWithRadar.Entities
{ {
public int Speed { get; private set; } public int Speed { get; private set; }
public double Weight { get; private set; } public double Weight { get; private set; }
public Color BodyColor { get; private set; } public Color BodyColor { get; set; }
public double Step => (double)Speed * 100 / Weight; public double Step => (double)Speed * 100 / Weight;
public EntityAirplane(int speed, double weight, Color bodyColor) public EntityAirplane(int speed, double weight, Color bodyColor)
{ {

View File

@ -9,7 +9,7 @@ namespace ProjectAirplaneWithRadar.Entities
{ {
public class EntityAirplaneWithRadar : EntityAirplane public class EntityAirplaneWithRadar : EntityAirplane
{ {
public Color AdditionalColor { get; private set; } public Color AdditionalColor { get; set; }
public bool Radar { get; private set; } public bool Radar { get; private set; }
public bool DopBak { get; private set; } public bool DopBak { get; private set; }
public EntityAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak) : base(speed, weight, bodyColor) public EntityAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak) : base(speed, weight, bodyColor)

View File

@ -70,13 +70,13 @@ namespace ProjectAirplaneWithRadar
{ {
case "airplaneLabel": case "airplaneLabel":
_airplane = new DrawningAirplane((int)numericSpeed.Value, _airplane = new DrawningAirplane((int)numericSpeed.Value,
(int)numericWeight.Value, Color.White, Color.Silver, Color.Black, pictureBox.Width, (int)numericWeight.Value, Color.Silver, pictureBox.Width,
pictureBox.Height); pictureBox.Height);
break; break;
case "airplaneWithRadarLabel": case "airplaneWithRadarLabel":
_airplane = new DrawningAirplaneWithRadar((int)numericSpeed.Value, _airplane = new DrawningAirplaneWithRadar((int)numericSpeed.Value,
(int)numericWeight.Value, Color.White, Color.Silver, Color.Black, pictureBox.Width, (int)numericWeight.Value, Color.Silver, Color.Black, checkRadar.Checked, checkDopBak.Checked, pictureBox.Width,
pictureBox.Height, 4, Color.Silver, checkRadar.Checked, checkDopBak.Checked); pictureBox.Height);
break; break;
} }
colorLabel.BackColor = Color.Empty; colorLabel.BackColor = Color.Empty;

View File

@ -0,0 +1,12 @@
using ProjectAirplaneWithRadar.DrawningObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectAirplaneWithRadar
{
public delegate void AirplaneDelegate(DrawningAirplane airplane);
}