Description:
Add EventEngine.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -0,0 +1,39 | |||
|
1 | using System; | |
|
2 | ||
|
3 | using Encompass; | |
|
4 | ||
|
5 | using isometricparkfna.Messages; | |
|
6 | ||
|
7 | namespace isometricparkfna.Engines | |
|
8 | { | |
|
9 | ||
|
10 | [Receives(typeof(TickMessage))] | |
|
11 | [Sends(typeof(SpawnDialogMessage))] | |
|
12 | class EventEngine : Engine | |
|
13 | { | |
|
14 | ||
|
15 | Random Random; | |
|
16 | ||
|
17 | public EventEngine() | |
|
18 | { | |
|
19 | this.Random = new Random(); | |
|
20 | } | |
|
21 | ||
|
22 | public override void Update(double dt) | |
|
23 | { | |
|
24 | foreach (var tick in ReadMessages<TickMessage>()) | |
|
25 | { | |
|
26 | ||
|
27 | if (this.Random.Next(0, 10) == 1) | |
|
28 | { | |
|
29 | Logging.Debug("Spawning Once dialog."); | |
|
30 | SendMessage(new SpawnDialogMessage { Path = "Once" }); | |
|
31 | } | |
|
32 | ||
|
33 | } | |
|
34 | } | |
|
35 | ||
|
36 | ||
|
37 | ||
|
38 | } | |
|
39 | } |
@@ -22,7 +22,7 | |||
|
22 | 22 | typeof(SetDialogMessage), |
|
23 | 23 | typeof(DialogChoiceMessage))] |
|
24 | 24 | [Reads(typeof(DialogComponent), |
|
25 |
|
|
|
25 | typeof(WindowTypeComponent), | |
|
26 | 26 | typeof(VisibilityComponent), |
|
27 | 27 | typeof(SelectedComponent))] |
|
28 | 28 | [Writes(typeof(VisibilityComponent), |
@@ -259,6 +259,8 | |||
|
259 | 259 | WorldBuilder.AddEngine(new UIEngine(this.Story)); |
|
260 | 260 | WorldBuilder.AddEngine(new DialogEngine(this.Story, this.grammar)); |
|
261 | 261 | |
|
262 | WorldBuilder.AddEngine(new EventEngine()); | |
|
263 | ||
|
262 | 264 | var gameBridgeEngine = new GameBridgeEngine(this); |
|
263 | 265 | |
|
264 | 266 | WorldBuilder.AddEngine(gameBridgeEngine); |
You need to be logged in to leave comments.
Login now