質問編集履歴
2
環境の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -104,7 +104,7 @@
|
|
104
104
|
|
105
105
|
### 補足情報(FW/ツールのバージョンなど)
|
106
106
|
|
107
|
-
環境:Windows10、VisualStudio2019、Unity2020.1.
|
107
|
+
環境:Windows10、VisualStudio2019、Unity2020.1.6f1 Personal
|
108
108
|
|
109
109
|
|
110
110
|
分かりづらいところなどあればご指摘ください。
|
1
ソースコードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -107,4 +107,63 @@
|
|
107
107
|
環境:Windows10、VisualStudio2019、Unity2020.1.0b13 Personal
|
108
108
|
|
109
109
|
|
110
|
-
分かりづらいところなどあればご指摘ください。
|
110
|
+
分かりづらいところなどあればご指摘ください。
|
111
|
+
|
112
|
+
### 追記
|
113
|
+
※コメントアウトしているところはリストでカードの種類を増やそうと試しているところです。一応書いておきます。
|
114
|
+
```C#
|
115
|
+
using System.Collections;
|
116
|
+
using System.Collections.Generic;
|
117
|
+
using UnityEngine;
|
118
|
+
using UnityEngine.UI;
|
119
|
+
|
120
|
+
//カードのステータス
|
121
|
+
[CreateAssetMenu(menuName = "MyScriptable/Create CardStatus2")]
|
122
|
+
public class CardStatus2 : ScriptableObject
|
123
|
+
{
|
124
|
+
public string CardName = "";
|
125
|
+
public int Level;
|
126
|
+
public int Hp;
|
127
|
+
public int Attack;
|
128
|
+
public int Defense;
|
129
|
+
public Sprite sprite;
|
130
|
+
//public List<CardStatus2> CardStatus2List = new List<CardStatus2>();
|
131
|
+
}
|
132
|
+
|
133
|
+
//[System.Serializable]
|
134
|
+
/*public class CardStatus2Data
|
135
|
+
{
|
136
|
+
public string CardName = "";
|
137
|
+
public int Level;
|
138
|
+
public int Hp;
|
139
|
+
public int Attack;
|
140
|
+
public int Defense;
|
141
|
+
public Sprite sprite;
|
142
|
+
}*/
|
143
|
+
```
|
144
|
+
```C#
|
145
|
+
using System.Collections;
|
146
|
+
using System.Collections.Generic;
|
147
|
+
using UnityEngine;
|
148
|
+
using UnityEngine.UI;
|
149
|
+
|
150
|
+
//プレイヤーのステータス
|
151
|
+
public class PlayerStatus : MonoBehaviour
|
152
|
+
{
|
153
|
+
public CardStatus2 CardStatus2;
|
154
|
+
|
155
|
+
public int playerLevel; //プレイヤーのレベル
|
156
|
+
public int playerHp; //プレイヤーのHP
|
157
|
+
public int playerAttack; //プレイヤーの攻撃力
|
158
|
+
public int playerDefense;//プレイヤーの防御力
|
159
|
+
|
160
|
+
void Start()
|
161
|
+
{
|
162
|
+
playerHp = CardStatus2.Hp; //カードのHPを代入する
|
163
|
+
playerAttack = CardStatus2.Attack; //カードのAttackを代入する
|
164
|
+
playerDefense = CardStatus2.Defense; //カードのDefenseを代入する
|
165
|
+
}
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
```
|