示例#1
0
    public List <Vector2Int> GetAvailableMovePositions(UnitBase unit)
    {
        List <Vector2Int> unitMovePositions = unit.GetAvailableMovePositions();
        List <Vector2Int> tiles             = new List <Vector2Int>();

        tiles.Add(unit.truePosition);
        Vector2Int north = unit.truePosition + new Vector2Int(0, 1);
        Vector2Int south = unit.truePosition + new Vector2Int(0, -1);
        Vector2Int east  = unit.truePosition + new Vector2Int(1, 0);
        Vector2Int west  = unit.truePosition + new Vector2Int(-1, 0);

        RecurseNonBlockedTiles(north, tiles, unitMovePositions);
        RecurseNonBlockedTiles(south, tiles, unitMovePositions);
        RecurseNonBlockedTiles(east, tiles, unitMovePositions);
        RecurseNonBlockedTiles(west, tiles, unitMovePositions);

        return(tiles);
    }