예제 #1
0
        private RectTransform GetTileCell(Transform tile)
        {
            RectTransform cellRect;

            BaseTile Tile = tile.GetComponent <BaseTile>();

            if (Tile != null)
            {
                cellRect = Tile.Cell;
            }
            else
            {
                cellRect = tile.parent.GetComponent <RectTransform>();
            }
            return(cellRect);
        }
예제 #2
0
        private void UpdateTile(Transform tile, Vector3 position, bool isInteractable)
        {
            // The Tile's cell is not necessarily the parent of the tile due
            // to work arounds for the fact that depth sorting of Unity UI is tied to
            // the objects location in the scene hierarchy instead of the z-position.
            // As a result, the staggered position of the tile is passed into this function
            // in world space. It must be translated back into the local space of the
            // tile's parent to make sure that the the staggered animation is only overriding the
            // x-axis of the tile in local space.
            Vector3 animatedLocalPos = tile.parent.InverseTransformPoint(position);
            Vector3 localPosition    = tile.localPosition;

            localPosition.x    = animatedLocalPos.x;
            tile.localPosition = localPosition;
            BaseTile Tile = tile.GetComponent <BaseTile>();

            if (Tile != null)
            {
                Tile.IsInteractable = isInteractable;
            }
        }