回答編集履歴
3
書式の改善
answer
CHANGED
@@ -27,12 +27,12 @@
|
|
27
27
|
|
28
28
|
void LocalInstantate() {
|
29
29
|
// ランダムでインデックスを選択
|
30
|
-
|
30
|
+
int _customerIndex = Random.Range(0, nonExistence.Count);
|
31
31
|
|
32
32
|
// 存在しないキャラクターのリストのインデックスから
|
33
33
|
// キャラクターの種類を選択してインスタンス化
|
34
|
-
|
34
|
+
int _customerNum = nonExistence[_customerIndex];
|
35
|
-
|
35
|
+
GameObject obj = (GameObject) Instantiate(characters[_customerNum]);
|
36
36
|
obj.transform.parent = transform;
|
37
37
|
obj.transform.localPosition = new Vector3(-3.35f, -1.44f, 0);
|
38
38
|
|
@@ -71,7 +71,7 @@
|
|
71
71
|
public int customerNum;
|
72
72
|
|
73
73
|
void LeaveStore(){
|
74
|
-
|
74
|
+
CustomerInStore _customerInStore = transform.parent.GetComponent<CustomerInStore>();
|
75
75
|
_customerInStore.AddNonExistenceList(customerNum);
|
76
76
|
Destroy(gameObject);
|
77
77
|
}
|
2
修正が反映されてないため、再送信
answer
CHANGED
File without changes
|
1
文法の修正
answer
CHANGED
@@ -58,7 +58,8 @@
|
|
58
58
|
// キャラクターの生成までの時間
|
59
59
|
if (nextSpawnTime < Time.timeSinceLevelLoad && isCanComeCustomer == true) {
|
60
60
|
nextSpawnTime = Time.timeSinceLevelLoad + interval;
|
61
|
+
// リストの要素数が0より大きいときにのみ実行する
|
61
|
-
LocalInstantate();
|
62
|
+
if(0 < nonExistence.Count) LocalInstantate();
|
62
63
|
}
|
63
64
|
}
|
64
65
|
}
|