//--------------------------------------// // 関数名 PutNewStage // // Function name PutNewStage // 機能 新しいステージの構築 // // Build a new stage function // 引数 なし // // No argument // 戻り値 なし // // No return value //--------------------------------------// private void PutNewStage() { // Variable to the repeated drawing float distance = 0.0f; // Save for the distance of the stage and players int stageNum = 0; // Element number storage of stage who is farthest float farPosZ = 0.0f; // Save for the farthest distance // I examine the stage that are farthest (furtest infront of player) for (int i = 0; i < stageData.Length; i++) { // Stage of this time if it has more distant than the previous stage if if (distance < playerPos.Z - stageData[i].PosZ) { // Save how much the away distance = playerPos.Z - stageData[i].PosZ; // Which stage or save was away stageNum = i; } // I remember the location of the plate was away the most farPosZ = stageData[stageNum].PosZ; } // If you still can be arranged if if (clearStageCount < 10) { // Set in the farthest for (int i = 0; i < stageData.Length; i++) { // Stage When you come to the front of the player if // Initialize the wall if (stageData[i].PosZ - 600.0 > playerPos.Z) { int temp = MyMathHelper.rand.Next(0, 7); //temp = 4; // The random generate a new stage stageData[i] = new StageData(temp); // Set the scale stageData[i].Scale = Vector3.One * 4.2f; // Set in the farthest position from the player stage stageData[i].PosZ = farPosZ - STAGE_LENGTH; // I keep updating only one frame stageData[i].OnlyOneFrameUpdate(); // Count the number of stages which cleared this.clearStageCount++; } } } // If state it can not be placed more else { if (!endStage.isPlayAnimation) { endStage.isPlayAnimation = true; endStage.PosZ = farPosZ - STAGE_LENGTH; endStage.Scale = Vector3.One * 4.2f; } } }
//------------------------------// // 関数名 InitStage // // Function name InitStage // 機能 ステージの初期化 // // Initialization function of stage // 引数 なし // // No argument // 戻り値 なし // // No return value //------------------------------// private void InitStage() { //----Initialization stage of start and end----// // Instantiation this.startStage = new StageData(7); this.endStage = new StageData(8); // Settings for each value this.startStage.Scale = Vector3.One * 4.2f; this.startStage.Rotation = Vector3.Zero; this.endStage.Scale = Vector3.One * 4.2f; this.endStage.Rotation = Vector3.Zero; // Whether to draw this.startStage.isPlayAnimation = true; this.endStage.isPlayAnimation = false; // Position setting this.startStage.PosZ = 505.0f; // 500 // I keep updating only one frame this.startStage.OnlyOneFrameUpdate(); this.endStage.OnlyOneFrameUpdate(); //----Initialization of each stage data----// for (int i = 0; i < MAX_STAGE_NUM; i++) { int temp = MyMathHelper.rand.Next(0, 7); //temp = 4; // Instance of the data stage (stages 0-6 is generated by random) this.stageData[i] = new StageData(temp); // Settings for each value // activation this.stageData[i].active = false; // Scale this.stageData[i].Scale = Vector3.One * 4.2f; // No rotation this.stageData[i].Rotation = Vector3.Zero; } // Positioning of the stage // Hard-coded only the very first stage this.stageData[0].PosZ = -560.0f; // Setting the stage for other for (int i = 0; i < stageData.Length; i++) { // I open stage one minute the position of all stages if (i < stageData.Length - 1) { stageData[i + 1].PosZ = stageData[i].PosZ - STAGE_LENGTH - 5.0f; } // Update only one frame stageData[i].OnlyOneFrameUpdate(); } // set stage active this.SetStageActive(); // init feedback InitFeedback(); }