diff --git a/Project/src/AbstractMap.java b/Project/src/AbstractMap.java index 8b952f8..9e73523 100644 --- a/Project/src/AbstractMap.java +++ b/Project/src/AbstractMap.java @@ -10,7 +10,6 @@ public abstract class AbstractMap protected int _height; protected float _size_x; protected float _size_y; - protected float[] position; protected Random _random = new Random(); protected int _freeRoad = 0; protected int _barrier = 1; @@ -119,29 +118,6 @@ public abstract class AbstractMap return DrawMapWithObject(); } - /* - private Direction MoveObjectBack(Direction direction) - { - switch (direction) - { - case Up: - return Direction.Up; - break; - case Down: - return Direction.Down; - break; - case Left: - return Direction.Left; - break; - case Right: - return Direction.Right; - break; - } - - return Direction.None; - } - */ - private boolean SetObjectOnMap() { if(_drawingObject == null || _map == null) diff --git a/Project/src/DesertStormMap.java b/Project/src/DesertStormMap.java index 10ce783..3128582 100644 --- a/Project/src/DesertStormMap.java +++ b/Project/src/DesertStormMap.java @@ -1,6 +1,7 @@ import java.awt.*; -public class DesertStormMap extends AbstractMap{ +public class DesertStormMap extends AbstractMap +{ //цвет закрытого участка private final Color barriedColor = new Color(139, 0, 0); @@ -8,7 +9,8 @@ public class DesertStormMap extends AbstractMap{ private final Color roadColor = new Color(255, 140, 0); @Override - protected void GenerateMap() { + protected void GenerateMap() + { _map = new int[100][100]; _size_x = (float)_width / _map.length; _size_y = (float)_height / _map[0].length; @@ -36,14 +38,16 @@ public class DesertStormMap extends AbstractMap{ } @Override - protected void DrawRoadPart(Graphics g, int i, int j) { + protected void DrawRoadPart(Graphics g, int i, int j) + { Graphics2D g2d = (Graphics2D)g; g2d.setPaint(roadColor); g2d.fillRect((int)(i * _size_x), (int)(j * _size_y), (int)(i * (_size_x + 1)), (int)(j *(_size_y + 1))); } @Override - protected void DrawBarrierPart(Graphics g, int i, int j) { + protected void DrawBarrierPart(Graphics g, int i, int j) + { Graphics2D g2d = (Graphics2D)g; g2d.setPaint(barriedColor); g.fillRect((int)(i * _size_x), (int)(j * _size_y), (int)(i * (_size_x + 1)), (int)(j *(_size_y + 1))); diff --git a/Project/src/DrawningObjectPlane.java b/Project/src/DrawningObjectPlane.java index 7240f70..89d6b0d 100644 --- a/Project/src/DrawningObjectPlane.java +++ b/Project/src/DrawningObjectPlane.java @@ -4,9 +4,7 @@ public class DrawningObjectPlane implements IDrawningObject { private DrawingPlane _plane = null; - public DrawningObjectPlane(DrawingPlane plane){ - _plane = plane; - } + public DrawningObjectPlane(DrawingPlane plane){ _plane = plane; } @Override public float Step() diff --git a/Project/src/EntityAirbus.java b/Project/src/EntityAirbus.java index 25c99c8..10cfcfe 100644 --- a/Project/src/EntityAirbus.java +++ b/Project/src/EntityAirbus.java @@ -1,6 +1,7 @@ import java.awt.*; -public class EntityAirbus extends EntityPlane{ +public class EntityAirbus extends EntityPlane +{ //Дополнительный цвет public Color AddColor; diff --git a/Project/src/FormAirbus.java b/Project/src/FormAirbus.java index d682a4e..84c4bce 100644 --- a/Project/src/FormAirbus.java +++ b/Project/src/FormAirbus.java @@ -43,7 +43,9 @@ public class FormAirbus ButtonDown.setIcon(new ImageIcon(img)); img = ImageIO.read(getClass().getResource("resourses/Right.png")); ButtonRight.setIcon(new ImageIcon(img)); - } catch (Exception ex){ + } + catch (Exception ex) + { System.out.println(ex.getMessage()); } diff --git a/Project/src/FormMap.java b/Project/src/FormMap.java index 294e93b..e08377f 100644 --- a/Project/src/FormMap.java +++ b/Project/src/FormMap.java @@ -29,7 +29,8 @@ public class FormMap extends JFrame public void Draw() { - if (bufferImg == null) { + if (bufferImg == null) + { return; } @@ -76,7 +77,8 @@ public class FormMap extends JFrame ButtonDown.setIcon(new ImageIcon(img)); img = ImageIO.read(getClass().getResource("resourses/Right.png")); ButtonRight.setIcon(new ImageIcon(img)); - } catch (Exception ex) + } + catch (Exception ex) { System.out.println(ex.getMessage()); } @@ -176,7 +178,6 @@ public class FormMap extends JFrame } }); - ComboBoxSelectorMap.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { diff --git a/Project/src/IAdditionalDrawingObject.java b/Project/src/IAdditionalDrawingObject.java index 2a39d53..cf9f27b 100644 --- a/Project/src/IAdditionalDrawingObject.java +++ b/Project/src/IAdditionalDrawingObject.java @@ -1,6 +1,7 @@ import java.awt.*; -public interface IAdditionalDrawingObject { +public interface IAdditionalDrawingObject +{ void SetAddEnum(int airplaneWindow); void DrawAirplaneWindow(Color colorAirplaneWindow, Graphics g, float _startPosX, float _startPosY); } diff --git a/Project/src/IDrawningObject.java b/Project/src/IDrawningObject.java index 5d5092e..fe90faa 100644 --- a/Project/src/IDrawningObject.java +++ b/Project/src/IDrawningObject.java @@ -1,6 +1,7 @@ import java.awt.*; -public interface IDrawningObject { +public interface IDrawningObject +{ //шаг перемещения объекта public float Step(); diff --git a/Project/src/Main.java b/Project/src/Main.java index 6b0c728..6387f7b 100644 --- a/Project/src/Main.java +++ b/Project/src/Main.java @@ -1,7 +1,9 @@ import javax.swing.*; -public class Main { - public static void main(String[] args) { +public class Main +{ + public static void main(String[] args) + { JFrame frame = new JFrame("Airbus"); frame.setContentPane(new FormMap().MainPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); diff --git a/Project/src/SimpleMap.java b/Project/src/SimpleMap.java index 7c016c8..0072a53 100644 --- a/Project/src/SimpleMap.java +++ b/Project/src/SimpleMap.java @@ -1,6 +1,7 @@ import java.awt.*; -public class SimpleMap extends AbstractMap{ +public class SimpleMap extends AbstractMap +{ //цвет закрытого участка private final Color barriedColor = Color.black; @@ -8,7 +9,8 @@ public class SimpleMap extends AbstractMap{ private final Color roadColor = Color.gray; @Override - protected void GenerateMap() { + protected void GenerateMap() + { _map = new int[100][100]; _size_x = (float)_width / _map.length; _size_y = (float)_height / _map[0].length; @@ -36,14 +38,16 @@ public class SimpleMap extends AbstractMap{ } @Override - protected void DrawRoadPart(Graphics g, int i, int j) { + protected void DrawRoadPart(Graphics g, int i, int j) + { Graphics2D g2d = (Graphics2D)g; g2d.setPaint(roadColor); g2d.fillRect((int)(i * _size_x), (int)(j * _size_y), (int)(i * (_size_x + 1)), (int)(j *(_size_y + 1))); } @Override - protected void DrawBarrierPart(Graphics g, int i, int j) { + protected void DrawBarrierPart(Graphics g, int i, int j) + { Graphics2D g2d = (Graphics2D)g; g2d.setPaint(barriedColor); g2d.fillRect((int)(i * _size_x), (int)(j * _size_y), (int)(i * (_size_x + 1)), (int)(j *(_size_y + 1))); diff --git a/Project/src/StarWarsMap.java b/Project/src/StarWarsMap.java index 01aa27d..40918a0 100644 --- a/Project/src/StarWarsMap.java +++ b/Project/src/StarWarsMap.java @@ -1,7 +1,8 @@ import java.awt.*; import java.util.Random; -public class StarWarsMap extends AbstractMap{ +public class StarWarsMap extends AbstractMap +{ Random rnd = new Random(); //цвет закрытого участка @@ -11,7 +12,8 @@ public class StarWarsMap extends AbstractMap{ private final Color roadColor = new Color(0, 0, 139); @Override - protected void GenerateMap() { + protected void GenerateMap() + { _map = new int[100][100]; _size_x = (float)_width / _map.length; _size_y = (float)_height / _map[0].length; @@ -39,14 +41,16 @@ public class StarWarsMap extends AbstractMap{ } @Override - protected void DrawRoadPart(Graphics g, int i, int j) { + protected void DrawRoadPart(Graphics g, int i, int j) + { Graphics2D g2d = (Graphics2D)g; g2d.setPaint(roadColor); g2d.fillRect((int)(i * _size_x), (int)(j * _size_y), (int)(i * (_size_x + 1)), (int)(j *(_size_y + 1))); } @Override - protected void DrawBarrierPart(Graphics g, int i, int j) { + protected void DrawBarrierPart(Graphics g, int i, int j) + { Graphics2D g2d = (Graphics2D)g; barriedColor = new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)); g2d.setPaint(barriedColor);