protected void OnDestroy() { GameOverEvent.UnregisterListener(GameOver); GameWonEvent.UnregisterListener(GameWon); GameStartEvent.UnregisterListener(GameStart); MenuEvent.UnregisterListener(Menu); }
private void LogEvent(GameWonEvent e) { if (e.LoggingLevel <= LoggingLevel) { Debug.Log(e.Description); } }
// Start is called before the first frame update void Start() { gameWonEvent = new GameWonEvent(); unityEvents.Add(EventName.GameWonEvent, gameWonEvent); EventManager.AddInvoker(EventName.GameWonEvent, this); ramdonColorToBe(); }
public void InvokeGameWonEvent() { gameIsOver = true; if (GameWonEvent != null) { GameWonEvent.Invoke(); } }
/// <summary> /// Called when the player has defeated all the waves. /// </summary> private void EndAssault() { GameWonEvent e = new GameWonEvent { Description = "Player defeated all waves. Game won." }; e.TriggerEvent(); }
public void RotateCell(int row, int col) { PlayingBoard.Cells[row, col] = Board.Rotate(PlayingBoard.Cells[row, col]); if (!_won && CheckForWin()) { GameWonEvent?.Invoke(this, new GameWonEventArgs(DateTime.UtcNow - StartTime)); _won = true; } }
protected void Awake() { if (NEBound == null || SWBound == null) { Debug.LogError("Bounds not set!"); } CameraLocked = true; // Register listeners GameStartEvent.RegisterListener(GameStart); GameWonEvent.RegisterListener(GameWon); GameOverEvent.RegisterListener(GameOver); }
protected void Awake() { if (GridRef == null) { Debug.LogError($"{name}: no grid object assigned!"); } if (ForbiddenMap == null) { Debug.LogError($"{name}: no forbidden map assigned!"); } if (ForbiddenTile == null) { Debug.LogError($"{name}: no forbidden tile assigned!"); } spriteRenderer = GetComponentInChildren <SpriteRenderer>(); if (spriteRenderer == null) { Debug.LogError($"{name}: no graphic child game object!"); } gm = FindObjectOfType <GameManager>(); if (gm == null) { Debug.LogError($"{name}: no game manager found!"); } defenderMenuButton = FindObjectOfType <DefenderMenuButton>(); if (defenderMenuButton == null) { Debug.LogError($"{name}: no defender menu button found!"); } cursor = spriteRenderer.sprite; CursorDisabled = true; // Register listeners GameOverEvent.RegisterListener(GameOver); GameWonEvent.RegisterListener(GameWon); GameStartEvent.RegisterListener(GameStart); MenuEvent.RegisterListener(Menu); }
protected void Awake() { PauseEvent.RegisterListener(LogEvent); MenuEvent.RegisterListener(LogEvent); TileSoldEvent.RegisterListener(LogEvent); TileDestroyedEvent.RegisterListener(LogEvent); TileDamageEvent.RegisterListener(LogEvent); TileUpdateEvent.RegisterListener(LogEvent); BaseDamageEvent.RegisterListener(LogEvent); BaseDamageUIEvent.RegisterListener(LogEvent); PurchaseMadeEvent.RegisterListener(LogEvent); PartsChangedUIEvent.RegisterListener(LogEvent); EnemyRecycledEvent.RegisterListener(LogEvent); GameStartEvent.RegisterListener(LogEvent); GameOverEvent.RegisterListener(LogEvent); GameWonEvent.RegisterListener(LogEvent); FastForwardEvent.RegisterListener(LogEvent); }
public static void IsGameWon() { int clicked = 0, bombs = 0; for (int i = 0; i < Box.GetLength(0); i++) { for (int j = 0; j < Box.GetLength(1); j++) { if (Box[i, j].IsClicked) { clicked++; } if (Box[i, j].HasBomb) { bombs++; } } } if (clicked == (Box.Length - bombs)) { RevealAllMines(true); GameWonEvent.Invoke(); } }
public void onEvent(GameWonEvent evt) { }
public static void PublishGameWonEvent() { GameWonEvent?.Invoke(); }
public virtual void onEvent(GameWonEvent evt) { }
private void OnGameWon(GameWonEvent obj) { _soundPlayer.PlayOneShot(_win); }
private void GameWon(GameWonEvent e) { gameObject.SetActive(true); }
private void GameWon(GameWonEvent e) { CursorDisabled = true; }
protected void Awake() { // Register listeners GameWonEvent.RegisterListener(GameWon); }
protected void OnDestroy() { GameWonEvent.UnregisterListener(GameWon); }
private void Awake() { gameWonEvent = new GameWonEvent(); }
private void InitializeGameWonEvent() { gameWonEvent = new GameWonEvent(); unityEvents.Add(EventName.GameWonEvent, gameWonEvent); EventManager.AddInvoker(EventName.GameWonEvent, this); }
private void GameWon(GameWonEvent e) { CameraLocked = true; }
public void OnGameWon(IEventSender sender, GameWonEvent ev) { DisplayWinPanel(); }
public override void onEvent(GameWonEvent evt) { mTime.Visibility = ViewStates.Gone; mTimeImage.Visibility = ViewStates.Gone; PopupManager.showPopupWon(evt.GameState); }
private void OnGameWon(GameWonEvent obj) { var text = Instantiate(_textPrefab, transform); text.Initialize($"Good Job! You didn't run out of space. Game will end in 10 seconds.", _movingTextTime); }