Example #1
0
        public static HashSet <Terrain> SelectTerrains(HashSet <Terrain> possibleTerrains, Color color, bool dotted)
        /// Selects terrains via click or selection frame
        {
            Select.UpdateFrame();

            HashSet <Terrain> framedTerrains = GetTerrainsInFrame(Select.frameRect, possibleTerrains);

            //displaying frame
            foreach (Terrain terrain in framedTerrains)
            {
                FrameDraw.DrawTerrainFrame(terrain, color, dotted, FrameDraw.defaultZOffset * 2);
            }

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

            return(null);
        }
Example #2
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);
        }