private void LogEvent(TileUpdateEvent e) { if (e.LoggingLevel <= LoggingLevel) { Debug.Log(e.Description); } }
protected void Awake() { if (Hole == null) { Debug.LogError($"{name}: no hole assigned!"); } gm = FindObjectOfType <GameManager>(); if (gm == null) { Debug.LogError($"{name}: no game manager found!"); } pathing = GetComponent <Pathing>(); if (pathing == null) { Debug.LogError($"{name}: No pathing component attached!"); } graphics = GetComponentsInChildren <SpriteRenderer>(); if (graphics[0] == null) { Debug.LogError($"{name}: missing child graphic object!"); } // Register listeners TileUpdateEvent.RegisterListener(TileUpdated); }
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 OnDestroy() { TileUpdateEvent.UnregisterListener(TileUpdated); }
// Recalculate our path when tiles have updated public void TileUpdated(TileUpdateEvent e) { CalculatePath(); }