public void TileHover(PathOnClick pathOnClick)
 {
     if (ValidityCheck(pathOnClick))
     {
         if (possibleTiles.ContainsKey(pathOnClick.Tile))
         {
             NewGlowPath(possibleTiles[pathOnClick.Tile]);
             if (possibleTiles[pathOnClick.Tile].OnHoverAction != null)
             {
                 possibleTiles[pathOnClick.Tile].OnHoverAction();
             }
         }
     }
     else
     {
         NewGlowPath(null);
         if (hoverExit != null)
         {
             hoverExit();
         }
         if (pathOnClick.Tile.BoardEntity != null)
         {
             profile.UpdateProfile(pathOnClick.Tile.BoardEntity);
         }
     }
 }
 private void unHighlightMovableTile(PathOnClick pathOnClick)
 {
     if (possibleTiles[pathOnClick.Tile].HighlightColor != null)
     {
         pathOnClick.ColorEffectManager.TurnOff(this);
     }
 }
        private void unGlowBoardEntity(PathOnClick tile)
        {
            BoardEntity boardEntity = tile.Tile.BoardEntity;

            if (boardEntity != null)
            {
                //boardEntity.GetComponentInChildren<GlowManager>().TurnOff(this);
            }
        }
        private void glowBoardEntity(PathOnClick tile)
        {
            BoardEntity boardEntity = tile.Tile.BoardEntity;

            if (boardEntity != null)
            {
                //boardEntity.GetComponentInChildren<GlowManager>().TurnOn(this, defaultBoardEntityHighlightColor);
            }
        }
 private bool ValidityCheck(PathOnClick pathOnClick)
 {
     // tile is not a valid moveable tile
     if (selectionCallBack != null && !possibleTiles.ContainsKey(pathOnClick.Tile))
     {
         return(false);
     }
     return(true);
 }
        private void highlightMovableTile(PathOnClick pathOnClick)
        {
            Color?highlightColor = defaultHighlightColor;

            if (possibleTiles.ContainsKey(pathOnClick.Tile))
            {
                highlightColor = possibleTiles[pathOnClick.Tile].HighlightColor;
            }
            if (highlightColor != null)
            {
                pathOnClick.ColorEffectManager.TurnOn(this, (Color)highlightColor);
            }
        }
        public void TileClicked(PathOnClick pathOnClick)
        {
            if (selectionCallBack != null && active)
            {
                //checks to see if the selected tile is unselectable
                if (!(pathOnClick != null && possibleTiles.ContainsKey(pathOnClick.Tile) && !possibleTiles[pathOnClick.Tile].Clickable))
                {
                    Action <TileSelectOption> tempSelectOption = selectionCallBack;
                    selectionCallBack = null;
                    BoardEntity tempSelectedEntity = selectedEntity;
                    selectedEntity = null;
                    ClearGlowPath();

                    foreach (Tile t in possibleTiles.Keys)
                    {
                        unHighlightMovableTile(t.GetComponentInChildren <PathOnClick>());
                    }
                    if (tempSelectedEntity != null)
                    {
                        unGlow(tempSelectedEntity.GetTile());
                    }

                    if (pathOnClick != null && possibleTiles.ContainsKey(pathOnClick.Tile))
                    {
                        tempSelectOption(possibleTiles[pathOnClick.Tile]);
                    }
                    else
                    {
                        tempSelectOption(null);
                        active = false;
                        if (pathOnClick != null && tempSelectedEntity != null && pathOnClick != tempSelectedEntity.GetTile().PathOnClick&& !isMovement)
                        {
                            //pathOnClick.OnMouseUp();
                        }
                        active = true;
                    }
                    isMovement = false;
                }
            }
        }
예제 #8
0
 void Start()
 {
     glowManager = GetComponent <GlowManager>();
     tile        = GetComponentInParent <Tile>();
     pathOnClick = GetComponent <PathOnClick>();
 }