質問編集履歴

2

ソースコードの追加記載

2020/05/13 08:00

投稿

flewgel
flewgel

スコア5

test CHANGED
File without changes
test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
 
20
20
 
21
-
21
+ CardControllerのコード
22
22
 
23
23
  ```C#
24
24
 
@@ -64,6 +64,8 @@
64
64
 
65
65
  ```
66
66
 
67
+ CardViewのコード
68
+
67
69
  ```C#
68
70
 
69
71
  using System.Collections;
@@ -113,3 +115,95 @@
113
115
  }
114
116
 
115
117
  ```
118
+
119
+ CardModelのchord
120
+
121
+ ```C#
122
+
123
+ using System.Collections;
124
+
125
+ using System.Collections.Generic;
126
+
127
+ using UnityEngine;
128
+
129
+
130
+
131
+ //カードデータとその処理
132
+
133
+ public class CardModel
134
+
135
+ {
136
+
137
+ public string name;
138
+
139
+ public int hp;
140
+
141
+ public int at;
142
+
143
+ public int cost;
144
+
145
+ public Sprite icon;
146
+
147
+
148
+
149
+ public CardModel()
150
+
151
+ {
152
+
153
+ CardEntity cardEntity = Resources.Load<CardEntity>("CardEntityList/Card1");
154
+
155
+ name = cardEntity.name;
156
+
157
+ hp = cardEntity.hp;
158
+
159
+ at = cardEntity.at;
160
+
161
+ cost = cardEntity.cost;
162
+
163
+ icon = cardEntity.icon;
164
+
165
+ }
166
+
167
+ }
168
+
169
+ ```
170
+
171
+ CardEntityのコード
172
+
173
+ ```C#
174
+
175
+ using System.Collections;
176
+
177
+ using System.Collections.Generic;
178
+
179
+ using UnityEngine;
180
+
181
+
182
+
183
+ //AssetMenuを表示させる
184
+
185
+ [CreateAssetMenu(fileName="CardEntity",menuName="Create CardEntity")]
186
+
187
+
188
+
189
+ //カードデータそのもの
190
+
191
+ public class CardEntity : ScriptableObject
192
+
193
+ {
194
+
195
+ public string name;
196
+
197
+ public int hp;
198
+
199
+ public int at;
200
+
201
+ public int cost;
202
+
203
+ public Sprite icon;
204
+
205
+ }
206
+
207
+
208
+
209
+ ```

1

誤字修正

2020/05/13 08:00

投稿

flewgel
flewgel

スコア5

test CHANGED
File without changes
test CHANGED
File without changes