回答編集履歴
1
コードを旧バージョン向けに変更
test
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
/// <summary>
|
28
28
|
|
29
|
-
///
|
29
|
+
/// お絵描き
|
30
30
|
|
31
31
|
/// </summary>
|
32
32
|
|
@@ -36,463 +36,477 @@
|
|
36
36
|
|
37
37
|
{
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
39
|
+
// ペンの半径...0で1ピクセルの線になる
|
40
|
+
|
41
|
+
[Range(0, 5)] public int penRadius;
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
// 前景色
|
46
|
+
|
47
|
+
public Color foregroundColor = Color.red;
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
// 背景色
|
52
|
+
|
53
|
+
[SerializeField] private Color backgroundColor = Color.white;
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
private RectTransform rectTransform;
|
58
|
+
|
59
|
+
private Image image;
|
60
|
+
|
61
|
+
private Texture2D texture;
|
62
|
+
|
63
|
+
private Vector2Int textureSize;
|
64
|
+
|
65
|
+
private Vector2Int previousPixelPosition;
|
66
|
+
|
67
|
+
private Vector2Int cachedPixelPosition;
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
// Undo、Redo用のテクスチャ格納庫
|
72
|
+
|
73
|
+
private readonly Stack<Texture2D> undoStack = new Stack<Texture2D>();
|
74
|
+
|
75
|
+
private readonly Stack<Texture2D> redoStack = new Stack<Texture2D>();
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
// Undo、Redo可能かどうかを外部スクリプトから調べたい場合、これらプロパティを参照する
|
80
|
+
|
81
|
+
public bool CanUndo
|
82
|
+
|
83
|
+
{
|
84
|
+
|
85
|
+
get { return this.undoStack.Count > 0; }
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
public bool CanRedo
|
92
|
+
|
93
|
+
{
|
94
|
+
|
95
|
+
get { return this.redoStack.Count > 0; }
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
// Undo時にはundoStackからテクスチャを1つ取り出して現在のテクスチャとし、
|
102
|
+
|
103
|
+
// 古いテクスチャはredoStackに積んでおく
|
104
|
+
|
105
|
+
public void Undo()
|
106
|
+
|
107
|
+
{
|
108
|
+
|
109
|
+
if (!this.CanUndo)
|
110
|
+
|
111
|
+
{
|
112
|
+
|
113
|
+
return;
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
var previousTexture = this.texture;
|
120
|
+
|
121
|
+
var poppedTexture = this.undoStack.Pop();
|
122
|
+
|
123
|
+
this.texture = poppedTexture;
|
124
|
+
|
125
|
+
this.redoStack.Push(previousTexture);
|
126
|
+
|
127
|
+
this.UpdateSprite();
|
128
|
+
|
129
|
+
Debug.LogFormat("Undo! UndoStack : {0} RedoStack : {1}", this.undoStack.Count, this.redoStack.Count);
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
// Redo時にはredoStackからテクスチャを1つ取り出して現在のテクスチャとし、
|
136
|
+
|
137
|
+
// 古いテクスチャはundoStackに積んでおく
|
138
|
+
|
139
|
+
public void Redo()
|
140
|
+
|
141
|
+
{
|
142
|
+
|
143
|
+
if (!this.CanRedo)
|
144
|
+
|
145
|
+
{
|
146
|
+
|
147
|
+
return;
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
var previousTexture = this.texture;
|
154
|
+
|
155
|
+
var poppedTexture = this.redoStack.Pop();
|
156
|
+
|
157
|
+
this.texture = poppedTexture;
|
158
|
+
|
159
|
+
this.undoStack.Push(previousTexture);
|
160
|
+
|
161
|
+
this.UpdateSprite();
|
162
|
+
|
163
|
+
Debug.LogFormat("Redo! UndoStack : {0} RedoStack : {1}", this.undoStack.Count, this.redoStack.Count);
|
164
|
+
|
165
|
+
}
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
// テクスチャに何かしらの操作(線を引くなど)を行う前にはRecordを実行することにする
|
170
|
+
|
171
|
+
// これによって変更前のテクスチャが複製されundoStackに積まれる
|
172
|
+
|
173
|
+
// また、このタイミングでredoStackは空にする
|
174
|
+
|
175
|
+
private void Record()
|
176
|
+
|
177
|
+
{
|
178
|
+
|
179
|
+
this.undoStack.Push(Instantiate(this.texture));
|
180
|
+
|
181
|
+
foreach (var textureInRedoStack in this.redoStack)
|
182
|
+
|
183
|
+
{
|
184
|
+
|
185
|
+
Destroy(textureInRedoStack);
|
186
|
+
|
187
|
+
}
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
this.redoStack.Clear();
|
192
|
+
|
193
|
+
Debug.LogFormat("Record! UndoStack : {0} RedoStack : {1}", this.undoStack.Count, this.redoStack.Count);
|
194
|
+
|
195
|
+
}
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
private void UpdateSprite()
|
200
|
+
|
201
|
+
{
|
202
|
+
|
203
|
+
var previousSprite = this.image.sprite;
|
204
|
+
|
205
|
+
this.image.sprite = Sprite.Create(
|
206
|
+
|
207
|
+
this.texture,
|
208
|
+
|
209
|
+
new Rect(0, 0, this.texture.width, this.texture.height),
|
210
|
+
|
211
|
+
Vector2.zero);
|
212
|
+
|
213
|
+
Destroy(previousSprite);
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
private Vector2Int GetPixelPosition()
|
220
|
+
|
221
|
+
{
|
222
|
+
|
223
|
+
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(
|
224
|
+
|
225
|
+
this.rectTransform,
|
226
|
+
|
227
|
+
Input.mousePosition,
|
228
|
+
|
229
|
+
null,
|
230
|
+
|
231
|
+
out var pixelPositionFloat))
|
232
|
+
|
233
|
+
{
|
234
|
+
|
235
|
+
return this.cachedPixelPosition;
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
var sizeDelta = this.rectTransform.sizeDelta;
|
242
|
+
|
243
|
+
pixelPositionFloat += sizeDelta * this.rectTransform.pivot;
|
244
|
+
|
245
|
+
var pixelPosition = new Vector2Int(
|
246
|
+
|
247
|
+
Mathf.Clamp((int)pixelPositionFloat.x, 0, this.textureSize.x - 1),
|
248
|
+
|
249
|
+
Mathf.Clamp((int)pixelPositionFloat.y, 0, this.textureSize.y - 1));
|
250
|
+
|
251
|
+
Debug.LogFormat("Pixel Position: {0}", pixelPosition);
|
252
|
+
|
253
|
+
this.cachedPixelPosition = pixelPosition;
|
254
|
+
|
255
|
+
return this.cachedPixelPosition;
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
// 入力座標がテクスチャ範囲内ならtrue、さもなければfalse
|
262
|
+
|
263
|
+
private bool PositionIsWithinTexture(Vector2Int position)
|
264
|
+
|
265
|
+
{
|
266
|
+
|
267
|
+
return (position.x >= 0) && (position.y >= 0) &&
|
268
|
+
|
269
|
+
(position.x < this.textureSize.x) && (position.y < this.textureSize.y);
|
270
|
+
|
271
|
+
}
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
// 入力座標に円を描く
|
276
|
+
|
277
|
+
private void PaintAt(Vector2Int position, Color32 color, int radius)
|
278
|
+
|
279
|
+
{
|
280
|
+
|
281
|
+
var sqrRadius = radius * radius;
|
282
|
+
|
283
|
+
for (var i = -radius; i <= radius; i++)
|
284
|
+
|
285
|
+
{
|
286
|
+
|
287
|
+
for (var j = -radius; j <= radius; j++)
|
288
|
+
|
289
|
+
{
|
290
|
+
|
291
|
+
var p = new Vector2Int(position.x + i, position.y + j);
|
292
|
+
|
293
|
+
var dot = (i * i) + (j * j);
|
294
|
+
|
295
|
+
if ((dot <= sqrRadius) && this.PositionIsWithinTexture(p))
|
296
|
+
|
297
|
+
{
|
298
|
+
|
299
|
+
this.texture.SetPixel(p.x, p.y, color);
|
300
|
+
|
301
|
+
}
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
}
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
this.texture.Apply();
|
310
|
+
|
311
|
+
}
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
private void LineTo(Vector2Int from, Vector2Int to, Color32 color, int radius)
|
316
|
+
|
317
|
+
{
|
318
|
+
|
319
|
+
var penPosition = from;
|
320
|
+
|
321
|
+
var x = (float)penPosition.x;
|
322
|
+
|
323
|
+
var y = (float)penPosition.y;
|
324
|
+
|
325
|
+
var fromTo = to - from;
|
326
|
+
|
327
|
+
var fromToSign = new Vector2Int((int)Mathf.Sign(fromTo.x), (int)Mathf.Sign(fromTo.y));
|
328
|
+
|
329
|
+
var fromToXIsZero = fromToSign.x == 0;
|
330
|
+
|
331
|
+
var fromToYIsZero = fromToSign.y == 0;
|
332
|
+
|
333
|
+
fromToSign.x = fromToXIsZero ? 1 : fromToSign.x;
|
334
|
+
|
335
|
+
fromToSign.y = fromToYIsZero ? 1 : fromToSign.y;
|
336
|
+
|
337
|
+
var absFromTo = fromToSign * fromTo;
|
338
|
+
|
339
|
+
var dominantDirection = 0;
|
340
|
+
|
341
|
+
var delta = Vector2.zero;
|
342
|
+
|
343
|
+
if (absFromTo.x >= absFromTo.y)
|
344
|
+
|
345
|
+
{
|
346
|
+
|
347
|
+
var tangent = fromToXIsZero ? 0 : (float)fromTo.y / fromTo.x;
|
348
|
+
|
349
|
+
delta.x = fromToSign.x;
|
350
|
+
|
351
|
+
delta.y = tangent * delta.x;
|
352
|
+
|
353
|
+
}
|
354
|
+
|
355
|
+
else
|
356
|
+
|
357
|
+
{
|
358
|
+
|
359
|
+
var tangent = fromToYIsZero ? 0 : (float)fromTo.x / fromTo.y;
|
360
|
+
|
361
|
+
delta.y = fromToSign.y;
|
362
|
+
|
363
|
+
delta.x = tangent * delta.y;
|
364
|
+
|
365
|
+
dominantDirection = 1;
|
366
|
+
|
367
|
+
}
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
while (this.PositionIsWithinTexture(penPosition))
|
372
|
+
|
373
|
+
{
|
374
|
+
|
375
|
+
try
|
376
|
+
|
377
|
+
{
|
378
|
+
|
379
|
+
this.PaintAt(penPosition, color, radius);
|
380
|
+
|
381
|
+
x += delta.x;
|
382
|
+
|
383
|
+
y += delta.y;
|
384
|
+
|
385
|
+
penPosition.x = (int)x;
|
386
|
+
|
387
|
+
penPosition.y = (int)y;
|
388
|
+
|
389
|
+
if (fromToSign[dominantDirection] > 0)
|
390
|
+
|
391
|
+
{
|
392
|
+
|
393
|
+
if (penPosition[dominantDirection] >= to[dominantDirection])
|
394
|
+
|
395
|
+
{
|
396
|
+
|
397
|
+
break;
|
398
|
+
|
399
|
+
}
|
400
|
+
|
401
|
+
}
|
402
|
+
|
403
|
+
else
|
404
|
+
|
405
|
+
{
|
406
|
+
|
407
|
+
if (penPosition[dominantDirection] <= to[dominantDirection])
|
408
|
+
|
409
|
+
{
|
410
|
+
|
411
|
+
break;
|
412
|
+
|
413
|
+
}
|
414
|
+
|
415
|
+
}
|
416
|
+
|
417
|
+
}
|
418
|
+
|
419
|
+
catch (Exception e)
|
420
|
+
|
421
|
+
{
|
422
|
+
|
423
|
+
Debug.LogException(e);
|
424
|
+
|
425
|
+
break;
|
426
|
+
|
427
|
+
}
|
428
|
+
|
429
|
+
}
|
430
|
+
|
431
|
+
}
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
private void Start()
|
436
|
+
|
437
|
+
{
|
438
|
+
|
439
|
+
this.rectTransform = this.transform as RectTransform;
|
440
|
+
|
441
|
+
this.image = this.GetComponent<Image>();
|
442
|
+
|
443
|
+
var sizeDelta = this.rectTransform.sizeDelta;
|
444
|
+
|
445
|
+
var width = (int)sizeDelta.x;
|
446
|
+
|
447
|
+
var height = (int)sizeDelta.y;
|
448
|
+
|
449
|
+
this.texture = new Texture2D(width, height, TextureFormat.ARGB32, false) {filterMode = FilterMode.Bilinear};
|
450
|
+
|
451
|
+
this.texture.SetPixels32(Enumerable.Repeat<Color32>(this.backgroundColor, width * height).ToArray());
|
452
|
+
|
453
|
+
this.texture.Apply();
|
454
|
+
|
455
|
+
this.textureSize = new Vector2Int(width, height);
|
456
|
+
|
457
|
+
this.UpdateSprite();
|
458
|
+
|
459
|
+
}
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
private void Update()
|
464
|
+
|
465
|
+
{
|
466
|
+
|
467
|
+
if (Input.GetKeyDown(KeyCode.U))
|
468
|
+
|
469
|
+
{
|
470
|
+
|
471
|
+
this.Undo();
|
472
|
+
|
473
|
+
}
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
if (Input.GetKeyDown(KeyCode.R))
|
478
|
+
|
479
|
+
{
|
480
|
+
|
481
|
+
this.Redo();
|
482
|
+
|
483
|
+
}
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
if (Input.GetMouseButtonDown(0))
|
488
|
+
|
489
|
+
{
|
490
|
+
|
491
|
+
this.Record();
|
492
|
+
|
493
|
+
this.previousPixelPosition = this.GetPixelPosition();
|
494
|
+
|
495
|
+
}
|
496
|
+
|
497
|
+
else if (Input.GetMouseButton(0))
|
498
|
+
|
499
|
+
{
|
500
|
+
|
501
|
+
var currentPixelPosition = this.GetPixelPosition();
|
502
|
+
|
503
|
+
this.LineTo(this.previousPixelPosition, currentPixelPosition, this.foregroundColor, this.penRadius);
|
504
|
+
|
505
|
+
this.previousPixelPosition = currentPixelPosition;
|
506
|
+
|
507
|
+
}
|
508
|
+
|
509
|
+
}
|
496
510
|
|
497
511
|
}
|
498
512
|
|