質問編集履歴
2
_を修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -31,15 +31,15 @@
|
|
31
31
|
MyTransform = gameObject.transform;
|
32
32
|
|
33
33
|
Observable.Empty<Vector2>().StartWith(() => GetRandPos())
|
34
|
-
.SelectMany(
|
34
|
+
.SelectMany(pos =>
|
35
35
|
Observable.Timer(TimeSpan.FromSeconds(UnityEngine.Random.Range(RAND_INTERVAL_MIN, RAND_INTERVAL_MAX)))
|
36
|
-
.Select(
|
36
|
+
.Select(_ => pos)
|
37
37
|
)
|
38
|
-
.SelectMany(
|
38
|
+
.SelectMany(pos => this.UpdateAsObservable().Select(_ => pos))
|
39
|
-
.TakeWhile(
|
39
|
+
.TakeWhile(pos => Vector2.Distance(pos, MyTransform.position) >= DISTANCE)
|
40
|
-
.Select(
|
40
|
+
.Select(pos => GetNextPos(pos, MyTransform.position))
|
41
41
|
.RepeatUntilDestroy(this)
|
42
|
-
.Subscribe(
|
42
|
+
.Subscribe(pos => MyTransform.position = pos);
|
43
43
|
}
|
44
44
|
|
45
45
|
Vector2 GetNextPos(Vector2 target,Vector2 me)
|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
6. (Oncompleted) 完了後1から繰り返し
|
15
15
|
|
16
16
|
###実現したいこと
|
17
|
-
コードが複雑になっているので簡潔な方法がありましたらご教授いただきたいです。プロパティまたはフィールド(クロージャ)無しで実装したいです。言語は問いません。大変お手数ですがよろしくお願いいたします。
|
17
|
+
コードが複雑になっているので簡潔な方法がありましたらご教授いただきたいです。プロパティまたはフィールド(クロージャ)などの外部からの参照無しで実装したいです。言語は問いません。大変お手数ですがよろしくお願いいたします。
|
18
18
|
|
19
19
|
###現状のコード
|
20
20
|
```C#
|