Пример #1
0
 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);
 }
Пример #2
0
    protected void Awake()
    {
        grid = FindObjectOfType <Grid>();

        if (grid == null)
        {
            Debug.LogError($"{name}: unable to find grid!");
        }

        gm = FindObjectOfType <GameManager>();

        if (gm == null)
        {
            Debug.LogError($"{name}: unable to find game manager!");
        }

        if (HealthBarPrefab == null)
        {
            Debug.LogError($"{name}: no health bar prefab assigned!");
        }

        // Register listeners
        TileDamageEvent.RegisterListener(TakeDamage);
    }