質問編集履歴
2
ソースコードの追加記載
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
エラーコード
|
9
9
|
> Assets/Scripts/CardController.cs(17,21): error CS1729: 'CardModel' does not contain a constructor that takes 1 arguments
|
10
10
|
|
11
|
-
|
11
|
+
CardControllerのコード
|
12
12
|
```C#
|
13
13
|
using System.Collections;
|
14
14
|
using System.Collections.Generic;
|
@@ -31,6 +31,7 @@
|
|
31
31
|
}
|
32
32
|
|
33
33
|
```
|
34
|
+
CardViewのコード
|
34
35
|
```C#
|
35
36
|
using System.Collections;
|
36
37
|
using System.Collections.Generic;
|
@@ -55,4 +56,50 @@
|
|
55
56
|
|
56
57
|
}
|
57
58
|
}
|
59
|
+
```
|
60
|
+
CardModelのchord
|
61
|
+
```C#
|
62
|
+
using System.Collections;
|
63
|
+
using System.Collections.Generic;
|
64
|
+
using UnityEngine;
|
65
|
+
|
66
|
+
//カードデータとその処理
|
67
|
+
public class CardModel
|
68
|
+
{
|
69
|
+
public string name;
|
70
|
+
public int hp;
|
71
|
+
public int at;
|
72
|
+
public int cost;
|
73
|
+
public Sprite icon;
|
74
|
+
|
75
|
+
public CardModel()
|
76
|
+
{
|
77
|
+
CardEntity cardEntity = Resources.Load<CardEntity>("CardEntityList/Card1");
|
78
|
+
name = cardEntity.name;
|
79
|
+
hp = cardEntity.hp;
|
80
|
+
at = cardEntity.at;
|
81
|
+
cost = cardEntity.cost;
|
82
|
+
icon = cardEntity.icon;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
```
|
86
|
+
CardEntityのコード
|
87
|
+
```C#
|
88
|
+
using System.Collections;
|
89
|
+
using System.Collections.Generic;
|
90
|
+
using UnityEngine;
|
91
|
+
|
92
|
+
//AssetMenuを表示させる
|
93
|
+
[CreateAssetMenu(fileName="CardEntity",menuName="Create CardEntity")]
|
94
|
+
|
95
|
+
//カードデータそのもの
|
96
|
+
public class CardEntity : ScriptableObject
|
97
|
+
{
|
98
|
+
public string name;
|
99
|
+
public int hp;
|
100
|
+
public int at;
|
101
|
+
public int cost;
|
102
|
+
public Sprite icon;
|
103
|
+
}
|
104
|
+
|
58
105
|
```
|
1
誤字修正
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|