コード例 #1
0
		/// <summary>
		/// Adds a fade out effect around row, col positions in a circle
		/// </summary>
		void AnimateCells (int row, int col) {
			
			int radius = 6;
			for (int r = row - radius; r <= row + radius; r++) {
				if (r < 0 || r >= map.gridRows)
					continue;
				for (int c = col - radius; c <= col + radius; c++) {
					if (c < 0 || c >= map.gridColumns)
						continue;
					int distance = (int)Mathf.Sqrt ((row - r) * (row - r) + (col - c) * (col - c));
					if (distance < radius) {
						int cellIndex = r * map.gridColumns + c;
						switch (mode) {
						default:
							map.CellFadeOut (cellIndex, Color.red, distance * 0.25f);
							break;
						case ACTION_MODE.Flash:
							map.CellFlash (cellIndex, Color.red, distance * 0.25f);
							break;
						case ACTION_MODE.Blink:
							map.CellBlink (cellIndex, Color.red, distance * 0.25f);
							break;
						}
					}
				}
			}
		}