예제 #1
0
    public void Capture(Tile newBorder, UnityAction <WorldTile> capturedCallback)
    {
        PlayerBorderTilemap.SetTile(LocalPlace, newBorder);

        tileCaptured.Invoke(this);
        tileCaptured.RemoveAllListeners();
        tileCaptured.AddListener(capturedCallback);
    }
예제 #2
0
    private void Start()
    {
        boardHandler   = SingletonManager.Get <BoardHandler>();
        cManager       = SingletonManager.Get <CombatManager>();
        bCollider      = GetComponent <BoxCollider>();
        rectTransform  = GetComponent <RectTransform>();
        spriteRenderer = GetComponent <SpriteRenderer>();
        audioManager   = SingletonManager.Get <AudioManager>();

        //AddListener
        OnSelectTile.AddListener(boardHandler.OnTileClick);
        OnConnectTile.AddListener(boardHandler.OnTileConnect);
        OnDisconnectTile.AddListener(boardHandler.OnTileDisconnect);
        OnDeselectTile.AddListener(boardHandler.OnTileRelease);
    }
예제 #3
0
    public static void StartListening(string eventName, UnityAction <TaskableBase> listener)
    {
        TileEvent thisEvent = null;

        if (instance.tileEventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new TileEvent();
            thisEvent.AddListener(listener);
            instance.tileEventDictionary.Add(eventName, thisEvent);
        }
    }
예제 #4
0
 public void AddListener(UnityAction <TileType> listener)
 {
     tileEvent.AddListener(listener);
 }