質問編集履歴
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,4 +15,133 @@
|
|
15
15
|
また、Assets/StreamingAssetsにも置いてみましたが、そこでは組み込まれてしまうため、テクスチャが変更されません。
|
16
16
|
ビルドをしたときのCSVファイルに従ったテクスチャが貼られています。
|
17
17
|
|
18
|
-
なにか方法があれば、教えていただければと思います。
|
18
|
+
なにか方法があれば、教えていただければと思います。
|
19
|
+
|
20
|
+
```Unity
|
21
|
+
/* この上部でテクスチャの宣言 */
|
22
|
+
void Update()
|
23
|
+
{
|
24
|
+
if (Input.GetKeyDown(KeyCode.Space))
|
25
|
+
{
|
26
|
+
StartCoroutine("WaitCoordinateLeft");
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
IEnumerator WaitCoordinateLeft()
|
31
|
+
{
|
32
|
+
int e, c, p, s;
|
33
|
+
string str1 = "error";
|
34
|
+
string str2 = "error";
|
35
|
+
|
36
|
+
for (int count = 0; count < 10; count++)
|
37
|
+
{
|
38
|
+
|
39
|
+
/* フラグの確認 */
|
40
|
+
while (true)
|
41
|
+
{
|
42
|
+
//string f = Application.dataPath + "/StreamingAssets/flag_coordinate.csv";
|
43
|
+
string f = Application.dataPath + "../../../csv/flag_coordinate.csv";
|
44
|
+
StreamReader sr = new StreamReader(f, Encoding.GetEncoding("Shift_JIS"));
|
45
|
+
str1 = sr.ReadToEnd();
|
46
|
+
|
47
|
+
int sets = int.Parse(str1);
|
48
|
+
|
49
|
+
Debug.Log(str1 + " : " + sets);
|
50
|
+
sr.Close();
|
51
|
+
if (sets == count)
|
52
|
+
{
|
53
|
+
break;
|
54
|
+
}
|
55
|
+
else
|
56
|
+
{
|
57
|
+
Debug.Log("now loading...");
|
58
|
+
break;
|
59
|
+
};
|
60
|
+
}
|
61
|
+
|
62
|
+
//Debug.Log("コーディネートの読み込み " + count);
|
63
|
+
|
64
|
+
/* コーディネートの読み込み */
|
65
|
+
//string f2 = Application.dataPath + "/StreamingAssets/coordinate.csv";
|
66
|
+
string f2 = Application.dataPath + "../../../csv/coordinate.csv";
|
67
|
+
StreamReader sr2 = new StreamReader(f2, Encoding.GetEncoding("Shift_JIS"));
|
68
|
+
str2 = sr2.ReadToEnd();
|
69
|
+
|
70
|
+
sr2.Close();
|
71
|
+
|
72
|
+
var csvDatas = str2.Split(new[] { ',', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
73
|
+
|
74
|
+
e = int.Parse(csvDatas[1]);
|
75
|
+
c = int.Parse(csvDatas[2]);
|
76
|
+
p = int.Parse(csvDatas[3]);
|
77
|
+
s = int.Parse(csvDatas[4]);
|
78
|
+
|
79
|
+
/* コーディネートの設定 */
|
80
|
+
SetEye(e);
|
81
|
+
SetCloth(c);
|
82
|
+
SetPattern(p);
|
83
|
+
SetShoes(s);
|
84
|
+
|
85
|
+
Debug.Log("コーディネートの設定" + (count + 1));
|
86
|
+
Debug.Log("Left Coordinate " + count + " is " + e + " " + c + " " + p + " " + s);
|
87
|
+
|
88
|
+
Flag.CatchFlag(count);
|
89
|
+
//string f3 = Application.dataPath + "/../../csv/flag_coordinateSets.csv";
|
90
|
+
//StreamWriter sw = new StreamWriter(f3, false, Encoding.GetEncoding("Shift_JIS"));
|
91
|
+
//sw.WriteLine(count);
|
92
|
+
//sw.Close();
|
93
|
+
|
94
|
+
yield return new WaitForSeconds(12);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
```
|
98
|
+
```C
|
99
|
+
int main(){
|
100
|
+
int c; //現対戦数
|
101
|
+
if (GetAsyncKeyState(VK_SPACE)){ //スペースキー入力により開始
|
102
|
+
|
103
|
+
/* 各対戦 */
|
104
|
+
for (c = 0; c < NUMBER - 1; c++){
|
105
|
+
printf("%d対戦目\n", c + 1);
|
106
|
+
|
107
|
+
select_individual(); //対戦する個体の選択
|
108
|
+
OutputChoiceIndividual(); //対戦する個体をunityに渡す
|
109
|
+
printf("%d対戦個体:%d vs %d\n", c + 1, D.indivi[0], D.indivi[1]);
|
110
|
+
|
111
|
+
Check_coordinatie(c); //コーディネートを出力しましたよ
|
112
|
+
|
113
|
+
EyeTrack(); //視線情報の取得
|
114
|
+
OutputGazeposi(); //視線位置の出力
|
115
|
+
|
116
|
+
judgement_game(); //勝敗判定
|
117
|
+
calclation_fitness(); //評価値計算
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
return 0;
|
122
|
+
}
|
123
|
+
|
124
|
+
void OutputChoiceIndividual(){
|
125
|
+
FILE *fci;
|
126
|
+
|
127
|
+
sprintf(F.nIndividual, "..\..\..\csv\coordinate.csv", C.NumG);
|
128
|
+
//sprintf(F.nIndividual, "..\..\..\DisplayCoordinate\Assets\StreamingAssets\coordinate.csv", C.NumG);
|
129
|
+
|
130
|
+
/* ファイルオープン */
|
131
|
+
if ((fci = fopen(F.nIndividual, "w")) == NULL){
|
132
|
+
printf("Individualファイルオープン失敗\n");
|
133
|
+
exit(-1);
|
134
|
+
}
|
135
|
+
|
136
|
+
for (int i = 0; i < 2; i++){
|
137
|
+
for (int j = 0; j < 5; j++){
|
138
|
+
fprintf(fci, "%d, ", CG[D.indivi[i]].decimal[j]);
|
139
|
+
printf("%d, ", CG[D.indivi[i]].decimal[j]);
|
140
|
+
}
|
141
|
+
fprintf(fci, "\n");
|
142
|
+
printf("\n");
|
143
|
+
}
|
144
|
+
|
145
|
+
fclose(fci);
|
146
|
+
}
|
147
|
+
```
|