package io.sarl.demos.fireworks import io.sarl.core.Behaviors import io.sarl.core.DefaultContextInteractions import io.sarl.core.ExternalContextAccess import io.sarl.core.Initialize import io.sarl.core.InnerContextAccess import io.sarl.core.Lifecycle import io.sarl.core.Logging import io.sarl.core.MemberJoined import io.sarl.util.OpenEventSpaceSpecification import java.util.Random import java.util.UUID agent LaunchingArea { uses DefaultContextInteractions, Lifecycle, Behaviors, Logging, InnerContextAccess, ExternalContextAccess var rocketsQuantity: Integer var fireQuantity: Integer var gravity: Double var grid: Positions = new Positions var maxWidth = 10.0 var exited = false on SetupSettings { this.rocketsQuantity = occurrence.rocketsQuantity this.fireQuantity = occurrence.fireQuatity this.gravity = occurrence.gravity this.maxWidth = occurrence.maxWidth } on Exit [!hasMemberAgent]{ killMe } on Exit [hasMemberAgent && !exited] { exited = true innerContext.defaultSpace.emit(new Exit) } on Initialize [ occurrence.parameters.empty ] { rocketsQuantity = 20 fireQuantity = 30 gravity = 0.5 info("Setup Area") } on Initialize [ !occurrence.parameters.empty ]{ var ctrl = occurrence.parameters.get(0) as FXMLViewerController var ^space = defaultContext.createSpace(OpenEventSpaceSpecification, UUID.randomUUID) ctrl.setGUISpace(^space) ^space.register(asEventListener) ctrl.listenAndDraw(grid) info("Setup Area") } on CreateArea { var x: Double var i=0 var rnd = new Random() while (i