public void Capture(Tile newBorder, UnityAction <WorldTile> capturedCallback) { PlayerBorderTilemap.SetTile(LocalPlace, newBorder); tileCaptured.Invoke(this); tileCaptured.RemoveAllListeners(); tileCaptured.AddListener(capturedCallback); }
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); }
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); } }
public void AddListener(UnityAction <TileType> listener) { tileEvent.AddListener(listener); }