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

質問編集履歴

1

Stagecodeのソースコードを追加しました

2025/02/03 10:05

投稿

Hotnoa
Hotnoa

スコア3

title CHANGED
File without changes
body CHANGED
@@ -58,7 +58,139 @@
58
58
  }
59
59
  }
60
60
  ```
61
+ ```
62
+ using System.Collections;
63
+ using System.Collections.Generic;
64
+ using UnityEngine;
61
65
 
66
+ public class Stagecode : MonoBehaviour
67
+ {
68
+ GameObject obj;
69
+
70
+ private Stages[] Stagecodes;
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+ void Start()
79
+ {
80
+ GameObject Block = (GameObject)Resources.Load("Block");
81
+ GameObject Short = (GameObject)Resources.Load("Short");
82
+ GameObject Long = (GameObject)Resources.Load("Long");
83
+ GameObject Hole = (GameObject)Resources.Load("Hole");
84
+ GameObject HardBlock = (GameObject)Resources.Load("HardBlock");
85
+
86
+ Stagecodes = new Stages[]{
87
+ new Stages(new Gimmicks[] { new Gimmicks(3, 3, Block, 0,0) },
88
+ new Pieces[] { new Pieces(Short, 0, 1),new Pieces(Long, 0, 1) },
89
+ null ,
90
+ "はじめのいっぽ"),
91
+
92
+
93
+ new Pieces[]{ new Pieces(Short,135,1),new Pieces(Long,90,1),new Pieces(Short,315,1),new Pieces(Long,270,1)},
94
+ null ,
95
+ "風車"),
96
+
97
+ new Stages(new Gimmicks[] { new Gimmicks(4, 1, Block, 0,0), new Gimmicks(1, 2, Block, 0,0), new Gimmicks(2, 2,Block, 0,0), new Gimmicks(5, 2, Hole, 0,0), new Gimmicks(2, 3, Short, 270,0), new Gimmicks(3, 3, Block, 0,0), new Gimmicks(4, 3, Short, 90,0),new Gimmicks(2, 4, Short, 315,0),new Gimmicks(5, 4, Block, 0,0),new Gimmicks(2, 5,Block, 0,0)},
98
+ null,
99
+ new Remixes[] { new Remixes( new RemixElement[] { new RemixElement(Long, 90), new RemixElement(Short, 180) } ,1), new Remixes(new RemixElement[] { new RemixElement(Short, 45), new RemixElement(Short, 270) }, 1), new Remixes(new RemixElement[] { new RemixElement(Short, 0), new RemixElement(Short, 135) }, 2) } ,
100
+ "オーバーキル"),
101
+
102
+
103
+
104
+
105
+
106
+ };
107
+ }
108
+
109
+ public Stages[] Code
110
+ {
111
+ get { return Stagecodes; }
112
+ private set { Stagecodes = value; }
113
+ }
114
+ // Update is called once per frame
115
+ public struct Gimmicks
116
+ {
117
+ public int x;
118
+ public int y;
119
+ public GameObject Gimmick;
120
+ public int direction;
121
+ public int Extra;
122
+ public Gimmicks(int x,int y, GameObject Gimmick,int direction,int Extra)
123
+ {
124
+ this.x = x;
125
+ this.y = y;
126
+ this.Gimmick = Gimmick;
127
+ this.direction = direction;
128
+ this.Extra = Extra;
129
+ }
130
+ }
131
+ public struct Pieces
132
+ {
133
+ public GameObject Piece;
134
+ public int direction;
135
+ public int amount;
136
+ public Pieces(GameObject Piece,int direction, int amount )
137
+ {
138
+ this.amount = amount;
139
+ this.direction = direction;
140
+ this.Piece = Piece;
141
+ }
142
+ }
143
+ public struct RemixElement
144
+ {
145
+ public GameObject Piece;
146
+ public int direction;
147
+
148
+ public RemixElement(GameObject Piece,int direction )
149
+ {
150
+
151
+ this.direction = direction;
152
+ this.Piece = Piece ;
153
+ }
154
+ }
155
+
156
+ public struct Remixes
157
+ {
158
+ public RemixElement[] remixelement;
159
+ public int amount;
160
+ public Remixes(RemixElement[] remixelements,int amount)
161
+ {
162
+ this.remixelement = remixelements;
163
+ this.amount = amount;
164
+ }
165
+ }
166
+
167
+ public struct Stages
168
+ {
169
+ public Gimmicks[] gimmicks;
170
+ public Pieces[] pieces;
171
+ public Remixes[] remixes;
172
+
173
+ public string Stagename;
174
+
175
+ public Stages(Gimmicks[] gimmicks, Pieces[] pieces, Remixes[] remixes, string Stagename)
176
+ {
177
+ this.gimmicks = gimmicks;
178
+ this.pieces = pieces;
179
+ this.remixes = remixes;
180
+
181
+ this.Stagename = Stagename;
182
+
183
+
184
+
185
+ }
186
+ }
187
+
188
+ }
189
+ ```
190
+ ここでは省略してますが、Stagecodesの要素数は10個くらいあります
191
+
192
+
193
+
62
194
  ### 試したこと・調べたこと
63
195
  - [x] teratailやGoogle等で検索した
64
196
  - [x] ソースコードを自分なりに変更した