//------------------------------------------------------------------// // 関数名 ChangeCommand // // Function name ChangeCommand // 機能 あたり判定により選ばれているコマンドをチェンジする // // I want to change the command that is selecte by the judgment per function // 引数 なし // // No argument // 戻り値 なし // // No return value //------------------------------------------------------------------// private void ChangeCommand() { // Get the offset of each command // Replay var replayOffset = new Vector2(256.0f * this.replay.scale.X, 32.0f * this.replay.scale.Y); // End var exitOffset = new Vector2(256.0f * this.exit.scale.X, 32.0f * this.exit.scale.Y); // When you are hit with replay if(Collision.BoundingBox2D(this.replay.pos,replayOffset, this.handPointer.pos,this.handPointer.offset)) { // To replay the commands selected this.currentCommand = new Replay(); } // When you are hit with the end else if (Collision.BoundingBox2D(this.exit.pos, exitOffset, this.handPointer.pos, this.handPointer.offset)) { // To exit the command that is selected this.currentCommand = new Exit(); } // When nothing hit else { // Nothing is selected this.currentCommand = new NoneCommand(); } }
public ResultMenu() { // screen size this.w = Game1.graphics.GraphicsDevice.Viewport.Width; this.h = Game1.graphics.GraphicsDevice.Viewport.Height; // complete game this.Victory = false; // background this.bg_alpha = 0.0f; this.dark_alpha = 0.0f; // animation this.animate_start = false; this.drawall = false; this.showtext = false; // score this.yourscore_posx = w * 0.25f; this.yourscore_scale = 1.0f; this.score_posx = w * 0.5f; this.score_posy = h * 0.5f; this.score_sizex = 70; this.score_sizey = 70; this.score_scale = 2.0f; // gameover text this.gameover_text_y = h * 0.5f; this.gameover_text_alpha = 0.5f; // victory text this.victory_text_y = h * 0.75f; this.victory_text_alpha = 0.5f; // Configured without a command that is selected this.currentCommand = new NoneCommand(); // Initialization of the hand pointer this.handPointer = new HandPointer(); // Instantiation of each command this.replay = new SpriteObject(); this.exit = new SpriteObject(); // Adjustment of the position of each command //this.replay.pos = new Vector2(w * 0.5f, h * 0.32f); this.replay.pos = new Vector2(w * 0.5f, h * 0.75f); this.exit.pos = new Vector2(w * 0.5f, h * 0.625f); // Initialize the counter this.counter = 0.0f; }