Пример #1
0
        public void AddTrap(Tile tile, EnterTileAction trapAction)
        {
            GameObject   currentTrap = Instantiate(trap);
            TileListener listener    = currentTrap.GetComponent <TileListener>();

            listener.SetEnterAction(trapAction);
            if (listener != null)
            {
                tile.AddTileListener(listener);
                currentTrap.gameObject.transform.SetParent(tile.gameObject.transform);
                currentTrap.transform.localPosition = new Vector3(0, 0, 0);
            }
            else
            {
                Destroy(currentTrap);
            }
        }
Пример #2
0
 public void AddTileListener(TileListener tileListener)
 {
     tileListener.Init(tileListeners.Remove);
     tileListeners.Add(tileListener);
 }