示例#1
0
        public static List <Coord> SelectTiles(Vector3 tileSize, bool dotted, Dictionary <Coord, TerrainTile> terrainsLut = null, Transform parent = null)
        /// Selects tile coordinates via click or selection frame
        /// Returns null if selection was not finally made
        /// Could use only the terrainsLut, but that's not so intuitive
        {
            Select.UpdateFrame();

            List <Coord> framedCoords = GetTilesInFrame(Select.frameRect, tileSize, parent);

            //displaying frame
            foreach (Coord coord in framedCoords)
            {
                FrameDraw.DrawFrame(coord, tileSize, FrameDraw.pinColor, dotted, terrainsLut, FrameDraw.defaultZOffset * 2, parent);
            }

            //returning selected
            if (Select.justReleased || (!Select.isFrame && Event.current.type == EventType.MouseUp && Event.current.button == 0 && !Event.current.alt))
            {
                return(framedCoords);
            }

            return(null);
        }