diff --git a/isometric-park-fna/Engines/EventEngine.cs b/isometric-park-fna/Engines/EventEngine.cs new file mode 100644 --- /dev/null +++ b/isometric-park-fna/Engines/EventEngine.cs @@ -0,0 +1,39 @@ +using System; + +using Encompass; + +using isometricparkfna.Messages; + +namespace isometricparkfna.Engines +{ + + [Receives(typeof(TickMessage))] + [Sends(typeof(SpawnDialogMessage))] + class EventEngine : Engine + { + + Random Random; + + public EventEngine() + { + this.Random = new Random(); + } + + public override void Update(double dt) + { + foreach (var tick in ReadMessages()) + { + + if (this.Random.Next(0, 10) == 1) + { + Logging.Debug("Spawning Once dialog."); + SendMessage(new SpawnDialogMessage { Path = "Once" }); + } + + } + } + + + + } +} diff --git a/isometric-park-fna/Engines/UIEngine.cs b/isometric-park-fna/Engines/UIEngine.cs --- a/isometric-park-fna/Engines/UIEngine.cs +++ b/isometric-park-fna/Engines/UIEngine.cs @@ -22,7 +22,7 @@ typeof(SetDialogMessage), typeof(DialogChoiceMessage))] [Reads(typeof(DialogComponent), - typeof(WindowTypeComponent), + typeof(WindowTypeComponent), typeof(VisibilityComponent), typeof(SelectedComponent))] [Writes(typeof(VisibilityComponent), diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -259,6 +259,8 @@ WorldBuilder.AddEngine(new UIEngine(this.Story)); WorldBuilder.AddEngine(new DialogEngine(this.Story, this.grammar)); + WorldBuilder.AddEngine(new EventEngine()); + var gameBridgeEngine = new GameBridgeEngine(this); WorldBuilder.AddEngine(gameBridgeEngine);