Заполнила класс EntityWarship

This commit is contained in:
Senju 2022-09-23 09:06:38 +04:00
parent 949003d54a
commit 5606591132

View File

@ -1,5 +1,29 @@
package src; package src;
import java.awt.*;
import java.util.Random;
public class EntityWarship { public class EntityWarship {
private int Speed;
private void setSpeed(int speed){this.Speed = speed;}
public int getSpeed(){return Speed;}
private float Weight;
private void setWeight(float weight){this.Weight = weight;}
public float getWeight(){return Weight;}
private Color BodyColor ;
private void setBodyColor (Color bodyColor){this.BodyColor = bodyColor;}
public Color getBodyColor (){return BodyColor;}
public float Step;
public void Init(int speed, float weight, Color bodyColor)
{
Random rnd = new Random();
Speed = speed <= 0 ? rnd.nextInt(100) + 50 : speed;
Weight = weight <= 0 ? rnd.nextInt(30)+40 : weight;
BodyColor= bodyColor;
Step = Speed * 100 / Weight;
}
} }