示例#1
0
		//when selected
		public void OnSceneGUI ()
		{	
			//foreach (TerrainTile tile in mapMagic.tiles.All())
			//	EditorUtility.SetSelectedRenderState(tile.ActiveTerrain.GetComponent<Terrain>(), EditorSelectedRenderState.Hidden);

			current = this;
			if (mapMagic == null) mapMagic = (MapMagicObject)target;
			if (!mapMagic.enabled) return;

			FrameDraw.DrawSceneGUI(mapMagic);

			if (mapMagic.guiTiles)
				PinDraw.DrawSceneGUI(mapMagic, ref selectionMode);

			if (mapMagic.guiLocks)
				LockDraw.DrawSceneGUI(mapMagic); 

			current = null;
		}
示例#2
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);
        }
示例#3
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);
        }