-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assets Version: v0.0.2 Script Version: v0.0.3
- Loading branch information
Showing
9 changed files
with
117 additions
and
87 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.Events; | ||
|
||
namespace Level.Event | ||
{ | ||
public static class EventManager | ||
{ | ||
public delegate void StateChange(ref StateChangeEvent arg); | ||
public delegate void GameOver(ref GameOverEvent arg); | ||
public static UnityEvent onStart = new UnityEvent(); | ||
public static UnityEvent onBGButtonClick = new UnityEvent(); | ||
public static StateChange OnStateChange; | ||
public static GameOver onGameOver; | ||
|
||
public static void RunStateChangeEvent(GameState oldState, GameState newState, UnityAction<StateChangeEvent> callback) | ||
{ | ||
StateChangeEvent arg = new StateChangeEvent(oldState, newState); | ||
try { | ||
IAsyncResult iar = OnStateChange.BeginInvoke(ref arg, ar => { callback.Invoke(arg); }, null); | ||
OnStateChange.EndInvoke(ref arg, iar); | ||
} | ||
catch (NullReferenceException) { callback.Invoke(arg); } | ||
} | ||
|
||
public static void RunGameOverEvent(DeathCause deathCause, UnityAction<GameOverEvent> callback) | ||
{ | ||
GameOverEvent arg = new GameOverEvent(deathCause); | ||
try { | ||
IAsyncResult iar = onGameOver.BeginInvoke(ref arg, ar => { callback.Invoke(arg); }, null); | ||
onGameOver.EndInvoke(ref arg, iar); | ||
} | ||
catch (NullReferenceException) { callback.Invoke(arg); } | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 @@ | ||
using Level; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace Level.Event | ||
{ | ||
public class GameOverEvent | ||
{ | ||
public readonly DeathCause deathCause; | ||
public bool canceled = false; | ||
|
||
public GameOverEvent(DeathCause deathCause) | ||
{ | ||
this.deathCause = deathCause; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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