teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

タイトルの修正

2021/11/08 10:46

投稿

decman
decman

スコア1

title CHANGED
@@ -1,1 +1,1 @@
1
- 他クラスで宣言したListの値取得する方法につ
1
+ ScriptableObjectの値が外部参照で正しく取得できなことがある
body CHANGED
File without changes

3

メンバの状態の説明のため、MapData.csを追記しました。

2021/11/08 10:46

投稿

decman
decman

スコア1

title CHANGED
File without changes
body CHANGED
@@ -268,4 +268,27 @@
268
268
  }
269
269
  }
270
270
  }
271
+ ```
272
+
273
+ ```C#
274
+ ■MapData.cs
275
+ public class MapData : MonoBehaviour
276
+ {
277
+ //マップデータを持つクラス
278
+
279
+ private static int WidthNum;
280
+ private static int HeightNum;
281
+ private static string[,] GroundMapData;
282
+ private static string[,] ObjectMapData;
283
+
284
+   public int GetWidthNum()
285
+ {
286
+ return WidthNum;
287
+ }
288
+   public int GetHeightNum()
289
+ {
290
+ return HeightNum;
291
+ }
292
+  //文字数制限のため最低限の部分のみ記載しました。
293
+ }
271
294
  ```

2

MapTileDataListの中身を追記しました。

2021/11/08 10:15

投稿

decman
decman

スコア1

title CHANGED
File without changes
body CHANGED
@@ -42,6 +42,33 @@
42
42
  public Tile tile;
43
43
  }
44
44
  ```
45
+
46
+ ■MapTileDataListの中身
47
+ MapTileDataList[0].id = 0
48
+ MapTileDataList[0].cost = 1
49
+ MapTileDataList[0].canMove = true
50
+ MapTileDataList[0].tile = 002-Woods_fall_001
51
+
52
+ MapTileDataList[1].id = 1
53
+ MapTileDataList[1].cost = 2
54
+ MapTileDataList[1].canMove = true
55
+ MapTileDataList[1].tile = BrightForest-A2_001
56
+
57
+ MapTileDataList[2].id = 2
58
+ MapTileDataList[2].cost = 0
59
+ MapTileDataList[2].canMove = false
60
+ MapTileDataList[2].tile = 002-Woods_fall_013
61
+
62
+ MapTileDataList[3].id = 3
63
+ MapTileDataList[3].cost = 0
64
+ MapTileDataList[3].canMove = true
65
+ MapTileDataList[3].tile = 002-Woods_fall_011
66
+
67
+ MapTileDataList[4].id = 4
68
+ MapTileDataList[4].cost = 0
69
+ MapTileDataList[4].canMove = true
70
+ MapTileDataList[4].tile = Market-D_128
71
+
45
72
  ```C#
46
73
  ■MapInit.cs
47
74
 
@@ -127,6 +154,7 @@
127
154
  }
128
155
  }
129
156
  ```
157
+
130
158
  ```C#
131
159
  ■Routing.cs
132
160
  using System.Collections;

1

2021/11/08 10:08

投稿

decman
decman

スコア1

title CHANGED
File without changes
body CHANGED
@@ -213,7 +213,7 @@
213
213
  {
214
214
  //MapTileData = new MapTileData();
215
215
 
216
- Debug.Log(MapTileData.MapTileDataList.Count);      ←ここでは正しい値取得できない
216
+ Debug.Log(MapTileData.MapTileDataList.Count);      ←ここでは正しい値取得できない
217
217
 
218
218
  //課題:タイルマップリストの数が0になっている
219
219
  //List.Countで取得したいが、Staticじゃないので読めない