Создание класса-сущности.
This commit is contained in:
parent
49ba085587
commit
79ad67c00f
33
EntityStormtrooper.java
Normal file
33
EntityStormtrooper.java
Normal file
@ -0,0 +1,33 @@
|
||||
import java.awt.Color;
|
||||
import java.util.Random;
|
||||
|
||||
public class EntityStormtrooper {
|
||||
private int Speed = 0;
|
||||
|
||||
private float Weight = 0;
|
||||
|
||||
private Color BodyColor;
|
||||
|
||||
public float Step;
|
||||
|
||||
public int getSpeed() {
|
||||
return Speed;
|
||||
}
|
||||
|
||||
public float getWeight() {
|
||||
return Weight;
|
||||
}
|
||||
|
||||
public Color getBodyColor() {
|
||||
return BodyColor;
|
||||
}
|
||||
|
||||
public void Init(int speed, float weight, Color bodyColor){
|
||||
Random rnd = new Random();
|
||||
Speed = speed <= 0 ? rnd.nextInt(50 + 1) +50 : speed; //генерация в диапазоне от 50 до 100
|
||||
Weight = weight <= 0 ? rnd.nextInt(50 + 1) +50 : weight;
|
||||
Step = Speed * 100 / Weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user