Example #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);
            }
        }
Example #2
0
 public void SetEnterAction(EnterTileAction action)
 {
     enterAction = action;
 }