Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created October 23, 2019 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IntegerMan/c301c329fbec46b03913609554eb7caa to your computer and use it in GitHub Desktop.
Save IntegerMan/c301c329fbec46b03913609554eb7caa to your computer and use it in GitHub Desktop.
internal class MainViewModel : NotifyPropertyChangedBase
{
private Simulator.GameState _state;
public MainViewModel()
{
ResetCommand = new ActionCommand(Reset);
Reset();
}
public ActionCommand ResetCommand { get; }
private void Reset()
{
World.World world = WorldGeneration.makeDefaultWorld();
State = new Simulator.GameState(world, Simulator.SimulationState.Simulating, 30);
}
public Simulator.GameState State
{
get => _state;
set
{
_state = value;
OnPropertyChanged(nameof(TextGrid));
OnPropertyChanged(nameof(GameStatusText));
OnPropertyChanged(nameof(TurnsLeftText));
}
}
// Other properties largely unchanged...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment