2022-11-16 18:24:14 +04:00
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class EntityWarmlyShip {
|
|
|
|
|
private int Speed; //Скорость
|
|
|
|
|
private float Weight; //Вес
|
|
|
|
|
private Color BodyColor; //Цвет
|
|
|
|
|
private float Step; //Шаг при перемещении
|
|
|
|
|
|
|
|
|
|
//Инициализация
|
2022-11-28 23:26:56 +04:00
|
|
|
|
public EntityWarmlyShip(int speed, float weight, Color bodyColor)
|
2022-11-16 18:24:14 +04:00
|
|
|
|
{
|
|
|
|
|
Random random = new Random();
|
|
|
|
|
Speed = speed <= 0 ? random.nextInt(50, 150) : speed;
|
|
|
|
|
Weight = weight <= 0 ? random.nextInt(50, 150) : weight;
|
|
|
|
|
BodyColor = bodyColor;
|
|
|
|
|
Step = Speed * 100 / Weight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetSpeed(){
|
|
|
|
|
return Speed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float GetWeight(){
|
|
|
|
|
return Weight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Color GetBodyColor(){
|
|
|
|
|
return BodyColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float GetStep(){
|
|
|
|
|
return Step;
|
|
|
|
|
}
|
|
|
|
|
}
|