Skip to content

Instantly share code, notes, and snippets.

@shana
Last active July 26, 2018 19:41
Show Gist options
  • Select an option

  • Save shana/fa5e0e903b44dcdb711b2b5a7a3abc2d to your computer and use it in GitHub Desktop.

Select an option

Save shana/fa5e0e903b44dcdb711b2b5a7a3abc2d to your computer and use it in GitHub Desktop.
Rect lastRect = GUILayoutUtility.GetLastRect();
if (Event.current.type == EventType.Repaint)
{
if (game == null)
{
game = new Game();
game.Restart(lastRect);
}
game.Update();
}
else if (Event.current.type == EventType.MouseUp && lastRect.Contains(Event.current.mousePosition))
{
game.Click(Event.current.mousePosition);
}
Redraw();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment