Created
March 30, 2015 01:03
-
-
Save CryZe/20e563a4bbcae4540b0f to your computer and use it in GitHub Desktop.
A Hat in Time Auto Splitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum GameState : int | |
{ | |
Inactive = 0, | |
Running = 1, | |
Credits = 2 | |
} | |
[StructLayout(LayoutKind.Sequential)] | |
public struct GameData | |
{ | |
public GameState State; | |
public double UnpauseTime; | |
public bool IsPaused; | |
public double CurrentGameSessionTime; | |
public int TimePieceCount; | |
} | |
public bool Start(LiveSplitState timer, dynamic old, dynamic current) | |
{ | |
return current.GameData.State == GameState.Running && old.GameData.State == GameState.Inactive; | |
} | |
public bool Split(LiveSplitState timer, dynamic old, dynamic current) | |
{ | |
return current.GameData.TimePieceCount > old.GameData.TimePieceCount; | |
} | |
public bool Reset(LiveSplitState timer, dynamic old, dynamic current) | |
{ | |
return current.GameData.State == GameState.Inactive && old.GameData.State == GameState.Running; | |
} | |
public bool IsPaused(LiveSplitState timer, dynamic old, dynamic current) | |
{ | |
return current.GameData.IsPaused; | |
} | |
public TimeSpan? GameTime(LiveSplitState timer, dynamic old, dynamic current) | |
{ | |
return TimeSpan.FromSeconds(current.GameData.CurrentGameSessionTime); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment