36 lines
841 B
Java
36 lines
841 B
Java
import java.awt.*;
|
||
import java.util.*;
|
||
|
||
public class EntityWarmlyShip {
|
||
private int Speed; //Скорость
|
||
private float Weight; //Вес
|
||
private Color BodyColor; //Цвет
|
||
private float Step; //Шаг при перемещении
|
||
|
||
//Инициализация
|
||
public EntityWarmlyShip(int speed, float weight, Color bodyColor)
|
||
{
|
||
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;
|
||
}
|
||
}
|