Только осваиваю программирование, и возник такой вопрос: Есть некий класс Plane, в котором есть 3 текстуры и нужно выбрать случайную. И есть главный класс Main, в котором нужно в определенный момент поменять эту текстуру. Вот что у меня есть:
public class Plane extends Sprite {
private Array<TextureRegion> colorArray;
private TextureRegion color;
public TextureRegion redPlane;
public TextureRegion bluePlane;
public TextureRegion greenPlane;
public Plane(TextureRegion color) {
redPlane = ResourceManager.getInstance().getTextureRegion("planeRed");
greenPlane = ResourceManager.getInstance().getTextureRegion("planeGreen");
bluePlane = ResourceManager.getInstance().getTextureRegion("planeBlue");
colorArray = new Array<TextureRegion>();
this.color = color;
}
public void randomColor(){
colorArray.addAll(redPlane,greenPlane,bluePlane);
color = colorArray.random();
}
В главном классе:
private Plane plane;
...
plane = new Plane();
...
plane.randomColor();
Современные инструменты для криптотрейдинга: как технологии помогают принимать решения
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости