protected Dictionary <MapSquare, MapSquare.Interactable> GetInputsForOneDirection(Tools.Direction targetDirection)
        {
            Dictionary <MapSquare, MapSquare.Interactable> directionInputSquares = new Dictionary <MapSquare, MapSquare.Interactable>();
            MapSquare temp = unit.mapSquare.GetNeighbour(targetDirection);

            encounteredUntenterableSquare = false;

            for (int i = 1; i <= minMaxMoves.Item2 - doneMoves; i++)
            {
                if (temp != null)
                {
                    if (encounteredUntenterableSquare)
                    {
                        directionInputSquares.Add(temp, MapSquare.Interactable.InactiveChoice);
                    }
                    else if (i + doneMoves < minMaxMoves.Item1)
                    {
                        directionInputSquares.Add(temp, MapSquare.Interactable.NonfinalChoice);
                    }
                    else if (i + doneMoves <= minMaxMoves.Item2)
                    {
                        directionInputSquares.Add(temp, MapSquare.Interactable.ActiveChoice);
                        if (!temp.CanEnterSquare(unit, targetDirection))
                        {
                            encounteredUntenterableSquare = true;
                        }
                    }

                    temp = temp.GetNeighbour(targetDirection);
                }
                else
                {
                    break;
                }
            }
            return(directionInputSquares);
        }
Exemple #2
0
        public virtual bool CanMove(Tools.Direction direction)
        {
            MapSquare targetSquare = mapSquare.GetNeighbour(direction);

            return(targetSquare != null && targetSquare.CanEnterSquare(this, direction));
        }