|
@@ -1,6 +1,6 @@
|
|
|
= groovy_event
|
|
|
-:author:
|
|
|
-:revnumber:
|
|
|
+:author:
|
|
|
+:revnumber:
|
|
|
:revdate: 2016/03/17 20:48
|
|
|
:relfileprefix: ../../
|
|
|
:imagesdir: ../..
|
|
@@ -49,7 +49,7 @@ class EventHandler{
|
|
|
}
|
|
|
|
|
|
class CustomEvent{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
handler = new EventHandler();
|
|
|
eventBus.register(handler);
|
|
@@ -68,18 +68,18 @@ Here, EventBus will play the communicate media in our Groovy scripting solution.
|
|
|
|
|
|
=== Trigger
|
|
|
|
|
|
-If you build up your game world's activites from Action, Trigger is the brick to build Gameplay. It's the combination of : Event + Condition → Action
|
|
|
+If you build up your game world's activites from Action, Trigger is the brick to build Gameplay. It's the combination of : Event + Condition → Action
|
|
|
|
|
|
The concept of trigger can be describle like this: When an Event happen, if it's passed a Condition check, the Action is taken. A more detailed description envolve: the Enviroment - a specific Context of those 3 (E - C - A), Durations , Threaded or not, Executor … But here we concern the most simple form, the Context is the single specific that procedure the Event and its Global awareness.
|
|
|
|
|
|
In Groovy,
|
|
|
|
|
|
* Event is Class based, mentioned in the chapter above.
|
|
|
-* Condition can be modeled with a Closure
|
|
|
+* Condition can be modeled with a Closure
|
|
|
* Action also very suitable with a Closure representation.
|
|
|
|
|
|
|
|
|
-===== Example1:
|
|
|
+==== Example1:
|
|
|
|
|
|
[source,java]
|
|
|
----
|