PIbd-22_Bondarenko_M.S._War.../EntityWarmlyShip.java

36 lines
834 B
Java
Raw Normal View History

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; //Шаг при перемещении
//Инициализация
public void Init(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;
}
}