/// <summary> /// Fired when the game updates. /// </summary> /// <param name="args">The <see cref="EventArgs"/> instance containing the event data.</param> private static void Game_OnGameUpdate(EventArgs args) { if (OnGameLoad != null) { foreach (var subscriber in OnGameLoad.GetInvocationList() .Where(s => !NotifiedSubscribers.Contains(s))) { NotifiedSubscribers.Add(subscriber); subscriber.DynamicInvoke(new EventArgs()); } } if (NexusList.Count == 0 || _endGameCalled) { return; } foreach (var nexus in NexusList) { if (nexus != null && nexus.IsValid && nexus.Health <= 0) { if (OnGameEnd != null) { OnGameEnd(new EventArgs()); _endGameCalled = true; // Don't spam the event. } } } }
/// <summary> /// Fired when the game is started. /// </summary> /// <param name="args">The <see cref="EventArgs"/> instance containing the event data.</param> private static void Game_OnGameStart(EventArgs args) { LeagueSharp.Game.OnUpdate += Game_OnGameUpdate; if (OnGameLoad != null) { NotifiedSubscribers.AddRange(OnGameLoad.GetInvocationList()); OnGameLoad(new EventArgs()); } }
public void LoadGame() { SceneManager.LoadScene("Prime Scene with Single View"); try { OnGameLoad?.Invoke(); } catch (Exception e) { Debug.LogError("Load Fail!"); } }
//*/ #endregion #region Methods /// <summary> /// Fired when the game is started. /// </summary> /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param> private static void Game_OnGameStart(EventArgs args) { EloBuddy.Game.OnUpdate += new GameUpdate(Game_OnGameUpdate); if (OnGameLoad != null) { foreach (var subscriber in OnGameLoad.GetInvocationList().Where(s => !NotifiedSubscribers.Contains(s))) { NotifiedSubscribers.Add(subscriber); try { subscriber.DynamicInvoke(new EventArgs()); } catch (Exception ex) { Console.WriteLine(ex); } } } }
public void ClearAndReloadScene() { //unsub all from the events of the game if (OnInitComplete != null) { foreach (var d in OnInitComplete.GetInvocationList()) { OnInitComplete -= (d as InitCompleteAction); } } if (OnGameLoad != null) { foreach (var d in OnGameLoad.GetInvocationList()) { OnGameLoad -= (d as GameLoadAction); } } if (OnGameStart != null) { foreach (var d in OnGameStart.GetInvocationList()) { OnGameStart -= (d as GameStartAction); } } if (OnGameEnd != null) { foreach (var d in OnGameEnd.GetInvocationList()) { OnGameEnd -= (d as GameEndAction); } } SceneManager.LoadScene(0); }
/// <summary> /// Loads everything about the game. /// </summary> public static void LoadGame() { OnGameLoad?.Invoke(); }