1
0
mirror of https://github.com/klmp200/sarl-fireworks.git synced 2024-11-22 14:53:19 +00:00

reformatting all classes

This commit is contained in:
ngaud 2017-05-02 17:25:05 +02:00
parent 9890daffc8
commit 9316a74f07
10 changed files with 180 additions and 177 deletions

View File

@ -64,7 +64,6 @@ class Positions {
var rockets = new HashMap<UUID, RocketsPos>() var rockets = new HashMap<UUID, RocketsPos>()
var fire = new HashMap<UUID, FirePos>() var fire = new HashMap<UUID, FirePos>()
public def getRockets() : Map<UUID, RocketsPos> { public def getRockets() : Map<UUID, RocketsPos> {
return rockets.unmodifiableView return rockets.unmodifiableView
} }
@ -113,4 +112,3 @@ class Positions {
} }
} }

View File

@ -59,13 +59,16 @@ agent Fire {
xf = Math.random() * 10.0 - Math.random() * 5 xf = Math.random() * 10.0 - Math.random() * 5
yf = Math.random() * 10.0 + 1.0 yf = Math.random() * 10.0 + 1.0
} }
on FireReady { on FireReady {
move = atFixedDelay(30)[try{ move = atFixedDelay(30) [
wake(new UpdateFirePosition);} try {
catch(e: Exception) {e.printStackTrace}] wake(new UpdateFirePosition);
} catch (e : Exception) {
e.printStackTrace
}
]
} }
on UpdateFirePosition [isFromMe(occurrence) && !frozen && !destroyed] { on UpdateFirePosition [isFromMe(occurrence) && !frozen && !destroyed] {
@ -76,16 +79,20 @@ agent Fire {
if (grid !== null) { if (grid !== null) {
var list = new ArrayList<Vector<Double>> var list = new ArrayList<Vector<Double>>
x.forEach[pos | { x.forEach [pos |
{
var nvect = new Vector(2) var nvect = new Vector(2)
nvect.add(pos) nvect.add(pos)
list.add(nvect) list.add(nvect)
}] }
y.forEach[pos, i | { ]
y.forEach [pos, i |
{
var nvect = list.get(i) var nvect = list.get(i)
nvect.add(pos) nvect.add(pos)
list.set(i, nvect) list.set(i, nvect)
}] }
]
grid.setFirePosition(id, parentID, list) grid.setFirePosition(id, parentID, list)
} }

View File

@ -23,6 +23,7 @@ import java.util.Vector
agent Rocket { agent Rocket {
uses Lifecycle, Logging, Schedules, Behaviors, DefaultContextInteractions, InnerContextAccess uses Lifecycle, Logging, Schedules, Behaviors, DefaultContextInteractions, InnerContextAccess
var x : Double var x : Double
var y : Double var y : Double
var gravity : Double var gravity : Double
@ -76,9 +77,13 @@ agent Rocket {
lifetime = rnd.nextInt(5) * 300 + 300 lifetime = rnd.nextInt(5) * 300 + 300
id = UUID.randomUUID id = UUID.randomUUID
move = atFixedDelay(30)[try{ move = atFixedDelay(30) [
wake(new UpdateRocketPosition);} try {
catch(e: Exception) {e.printStackTrace}] wake(new UpdateRocketPosition);
} catch (e : Exception) {
e.printStackTrace
}
]
} }
on UpdateRocketPosition [isFromMe(occurrence) && !frozen && !exploded] { on UpdateRocketPosition [isFromMe(occurrence) && !frozen && !exploded] {

View File

@ -36,7 +36,6 @@ event SetupSettings {
} }
} }
event Freeze { event Freeze {
var value : boolean var value : boolean
@ -44,6 +43,3 @@ event Freeze {
this.value = value this.value = value
} }
} }

View File

@ -23,29 +23,26 @@ import javafx.util.Duration
class FXMLViewerController implements EventListener { class FXMLViewerController implements EventListener {
private var ispace : OpenEventSpace;
private val id : UUID = UUID.randomUUID(); private val id : UUID = UUID.randomUUID();
private var ispace : OpenEventSpace;
private var launched : boolean = false; private var launched : boolean = false;
private var areaCreated : boolean = false; private var areaCreated : boolean = false;
@FXML @FXML
private var draw_zone : Canvas; private var draw_zone : Canvas;
@FXML @FXML
private var gravity_display : Label; private var gravity_display : Label;
@FXML @FXML
private var rocket_quantity_display : Label; private var rocket_quantity_display : Label;
@FXML @FXML
private var fire_quantity_display : Label; private var fire_quantity_display : Label;
@FXML @FXML
private var gravity_input : ScrollBar; private var gravity_input : ScrollBar;
@FXML @FXML
private var rocket_quantity_input : ScrollBar; private var rocket_quantity_input : ScrollBar;
@FXML @FXML
private var fire_quantity_input : ScrollBar; private var fire_quantity_input : ScrollBar;
@FXML @FXML
private var setup_button : Button; private var setup_button : Button;
@FXML @FXML