예제 #1
0
 private void LogEvent(TileUpdateEvent e)
 {
     if (e.LoggingLevel <= LoggingLevel)
     {
         Debug.Log(e.Description);
     }
 }
예제 #2
0
    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);
    }
예제 #3
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);
 }
예제 #4
0
 protected void OnDestroy()
 {
     TileUpdateEvent.UnregisterListener(TileUpdated);
 }
예제 #5
0
 // Recalculate our path when tiles have updated
 public void TileUpdated(TileUpdateEvent e)
 {
     CalculatePath();
 }