PIbd-21_Kouvshinoff_T._A._W.../laba1Loco/EntityLoco.java

69 lines
2.5 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package laba1Loco;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.Timer;
import java.awt.event.*;
public class EntityLoco{
/// <summary>
/// Скорость
/// </summary>
public int Speed;
/// <summary>
/// Вес
/// </summary>
public double Weight;
/// <summary>
/// Основной цвет
/// </summary>
public Color BodyColor;
/// <summary>
/// Дополнительный цвет (для опциональных элементов)
/// </summary>
public Color AdditionalColor;
/// <summary>
/// Признак (опция) наличия трубы
/// </summary>
public boolean Tube;
/// <summary>
/// Признак (опция) наличия бака
/// </summary>
public boolean FuelTank;
/// <summary>
/// Признак (опция) наличия паровозной полосы
/// </summary>
public boolean LocoLine;
/// <summary>
/// Шаг перемещения автомобиля
/// </summary>
public double Step;
/// <summary>
/// количество колёс [2;4]
/// </summary>
public int numWheel;
/// <summary>
/// Инициализация полей объекта-класса спортивного автомобиля
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="tube">Признак наличия трубы</param>
/// <param name="fuelTank">Признак наличия бака</param>
/// <param name="locoLine">Признак паровозной гоночной полосы</param>
public void Init(int speed, double weight, Color bodyColor, Color
additionalColor, boolean tube, boolean fuelTank, boolean locoLine, int _numWheel)
{
numWheel = _numWheel;
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
AdditionalColor = additionalColor;
Tube = tube;
FuelTank = fuelTank;
LocoLine = locoLine;
Step = (double)Speed * 100 / Weight;
}
}