-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from forerunnergames/develop
Merge develop into master
- Loading branch information
Showing
18 changed files
with
1,079 additions
and
742 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
|
||
public interface IStateMachine <T> where T : Enum | ||
{ | ||
public delegate void TransitionAction(); | ||
public delegate bool TransitionTrigger(); | ||
public bool Is (T state); | ||
public void OnTransitionTo (T to, TransitionAction action); | ||
public void OnTransitionFrom (T from, TransitionAction action); | ||
public void OnTransition (T from, T to, TransitionAction action); | ||
public void AddTrigger (T from, T to, TransitionTrigger trigger); | ||
public void Update(); | ||
public void To (T to); | ||
public void ToIf (T to, bool condition); | ||
public void Push (T to); | ||
public void PushIf (T to, bool condition); | ||
public void Pop(); | ||
public void PopIf (bool condition); | ||
public void PopIf (T state); | ||
public void PopIf (T state, bool condition); | ||
public void Reset(); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using Godot; | ||
|
||
public static class Log | ||
{ | ||
public static Level CurrentLevel { get; set; } = Level.Info; | ||
|
||
public enum Level | ||
{ | ||
Off, | ||
Warn, | ||
Info, | ||
Debug, | ||
All | ||
} | ||
|
||
public static bool All (string message) => CurrentLevel > Level.Debug && Print (message, Level.All); | ||
public static bool Debug (string message) => CurrentLevel > Level.Info && Print (message, Level.Debug); | ||
public static bool Info (string message) => CurrentLevel > Level.Warn && Print (message, Level.Info); | ||
public static bool Warn (string message) => CurrentLevel > Level.Off && Print (message, Level.Warn); | ||
|
||
private static bool Print (string message, Level level) | ||
{ | ||
GD.Print ($"{level}: {DateTime.Now:HH:mm:ss:ffff} ", message); | ||
return true; | ||
} | ||
} |
Oops, something went wrong.