Исправления

This commit is contained in:
prodigygirl 2022-10-31 20:34:10 +04:00
parent be78034cce
commit fbef71ec0b
4 changed files with 9 additions and 11 deletions

View File

@ -178,10 +178,8 @@ namespace ArmoredCar
return (_startPosX, _startPosX + _carWidth, _startPosY, _startPosY + _carHeight);
}
public void setColor(Color color) {
if (ArmoredCar == null)
return;
ArmoredCar.setColor(color);
public virtual void setColor(Color color) {
ArmoredCar = new EntityArmoredCar(ArmoredCar.Speed, ArmoredCar.Weight, color);
}
}
}

View File

@ -47,11 +47,15 @@ namespace ArmoredCar
base.DrawTransport(g);
_startPosY -= 10;
}
public override void setColor(Color color)
{
ArmoredCar = new EntityTank(ArmoredCar.Speed, ArmoredCar.Weight, color,
(ArmoredCar as EntityTank).DopColor, (ArmoredCar as EntityTank).TowerWeapon, (ArmoredCar as EntityTank).AMachineGun);
}
public void setDopColor(Color color)
{
if (ArmoredCar is not EntityTank Tank)
return;
Tank.setDopColor(color);
ArmoredCar = new EntityTank(ArmoredCar.Speed, ArmoredCar.Weight, ArmoredCar.BodyColor,
color, (ArmoredCar as EntityTank).TowerWeapon, (ArmoredCar as EntityTank).AMachineGun);
}
}
}

View File

@ -37,7 +37,5 @@ namespace ArmoredCar
Weight = weight <= 0 ? rnd.Next(40, 70) : weight;
BodyColor = bodyColor;
}
public virtual void setColor(Color color) { BodyColor = color; }
}
}

View File

@ -39,7 +39,5 @@ namespace ArmoredCar
TowerWeapon = towerWeapon;
AMachineGun = aMachineGun;
}
public void setDopColor(Color dopColor){DopColor = dopColor;}
}
}