Commit Description:
Limit commands to when the game is running.
Commit Description:
Limit commands to when the game is running.
File last commit:
Show/Diff file:
Action:
isometric-park-fna/Engines/GameStateEngine.cs
43 lines | 874 B | text/x-csharp | CSharpLexer
using Encompass;
using isometricparkfna.Messages;
using isometricparkfna.Components;
namespace isometricparkfna.Engines {
[Receives(typeof(GameStateMessage))]
[Sends(typeof(ToggleWindowTypeMessage))]
[Reads(typeof(GameStateComponent))]
[Writes(typeof(GameStateComponent))]
class GameStateEngine : Engine
{
public override void Update(double dt)
{
foreach (var message in ReadMessages<GameStateMessage>())
{
if (message.isPlaying)
{
startGame();
}
SendMessage(new ToggleWindowTypeMessage { Window = Window.MainMenu});
foreach (var entity in ReadEntities<GameStateComponent>())
{
var state = GetComponent<GameStateComponent>(entity).isPlaying;
Logging.Spy(state, "state");
SetComponent(entity, new GameStateComponent{isPlaying = message.isPlaying});
}
}
}
public void startGame()
{
}
}
}