private void LogEvent(BaseDamageUIEvent e) { if (e.LoggingLevel <= LoggingLevel) { Debug.Log(e.Description); } }
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); }
protected void Awake() { textBox = GetComponent <TextMeshProUGUI>(); if (textBox == null) { Debug.LogError($"{name} does not have a text component!"); } gm = FindObjectOfType <GameManager>(); if (gm == null) { Debug.LogError($"{name} no game manager found!"); } // Register listeners BaseDamageUIEvent.RegisterListener(BaseDamaged); }
protected void OnDestroy() { BaseDamageUIEvent.UnregisterListener(BaseDamaged); }
private void BaseDamaged(BaseDamageUIEvent e) { textBox.text = gm.BaseHealth.ToString(); }