/// <summary> /// henter gameobets spriterender ned for at finde rectanglen /// collision patting /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { spriteRender = (SpriteRender)gameObject.FindCompent("SpriteRender"); MouseState mouse = Mouse.GetState(); ///checks om musen er inden for knappends område og om der bliver ///clickt elelr hovert if (ColisionBox.Contains(mouse.X, mouse.Y)) { if (mouse.LeftButton == ButtonState.Pressed) { State = state.Pressed; } if (mouse.LeftButton == ButtonState.Released) { State = state.Hover; } } else { State = state.none; } /// maybe losning switch (State) { case state.none: CLICK = "non"; // do somthing break; case state.Pressed: CLICK = "pressed"; Cliket = true; break; case state.Hover: CLICK = "Hover"; /// do somthing break; default: break; } if (Cliket == true) { wirteNames.Write_Name2(); if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { /// smed player2vbv½ name i database Hvis vi skal kunne huske det Cliket = false; } } base.Update(gameTime); }
public override void Update(GameTime gameTime) { MouseState mouse = Mouse.GetState(); thisrectangle = ColisionBox; spriteRender = (SpriteRender)gameObject.FindCompent("SpriteRender"); MousePosition.X = mouse.X; MousePosition.Y = mouse.Y; ///checks om musen er inden for knappends område og om der bliver ///clickt elelr hovert if (ColisionBox.Contains(MousePosition.X, MousePosition.Y)) { if (mouse.LeftButton == ButtonState.Pressed) { State = state.Pressed; } if (mouse.LeftButton == ButtonState.Released) { State = state.Hover; } } else { State = state.none; } switch (State) { case state.none: // do somthing break; case state.Pressed: break; case state.Hover: /// do somthing break; default: break; } base.Update(gameTime); }
public override void Update(GameTime gameTime) { MouseState mouse = Mouse.GetState(); thisrectangle = ColisionBox; spriteRender = (SpriteRender)gameObject.FindCompent("SpriteRender"); MousePosition.X = mouse.X; MousePosition.Y = mouse.Y; ///checks om musen er inden for knappends område og om der bliver ///clickt elelr hovert if (ColisionBox.Contains(MousePosition.X, MousePosition.Y)) { if (mouse.LeftButton == ButtonState.Pressed) { State = state.Pressed; } if (mouse.LeftButton == ButtonState.Released) { State = state.Hover; } } else { State = state.none; } switch (State) { case state.none: break; case state.Pressed: //if(GameWorld.CurrentState) CampsiteController.Instance.SetCaravanPrice(Player1 = writePrice.Writebogstav(4), true); break; case state.Hover: /// do somthing break; default: break; } base.Update(gameTime); }
public override void Update(GameTime gameTime) { spriteRender = (SpriteRender)gameObject.FindCompent("SpriteRender"); MouseState mouse = Mouse.GetState(); ///checks om musen er inden for knappends område og om der bliver ///clickt elelr hovert /// if (ColisionBox.Contains(mouse.X, mouse.Y)) { if (mouse.LeftButton == ButtonState.Pressed) { State = state.Pressed; } if (mouse.LeftButton == ButtonState.Released) { State = state.Hover; } } else { State = state.none; } /// maybe losning switch (State) { case state.none: CLICK = "non"; spriteRender.color = Color.White; // do somthing break; case state.Pressed: CLICK = "pressed"; GameWorld.Remove.Add(this.gameObject); spriteRender.color = Color.Black; foreach (var go in GameWorld.gameObjects) { GameWorld.Remove.Add(go); } Cliket = true; break; case state.Hover: CLICK = "Hover"; /// do somthing spriteRender.color = Color.Red; break; default: break; } base.Update(gameTime); }
public override void Update(GameTime gameTime) { spriteRender = (SpriteRender)gameObject.FindCompent("SpriteRender"); MouseState mouse = Mouse.GetState(); ///checks om musen er inden for knappends område og om der bliver ///clickt elelr hovert if (ColisionBox.Contains(mouse.X, mouse.Y)) { if (mouse.LeftButton == ButtonState.Pressed) { State = state.Pressed; } if (mouse.LeftButton == ButtonState.Released) { State = state.Hover; } } else { State = state.none; } /// maybe losning switch (State) { case state.none: CLICK = "non"; // do somthing spriteRender.color = Color.White; gameObject.transForm.size = 1; break; case state.Pressed: CLICK = "pressed"; spriteRender.color = Color.Gray; WRITE = true; break; case state.Hover: CLICK = "Hover"; spriteRender.color = Color.Salmon; gameObject.transForm.size = 1.5f; /// do somthing break; default: break; } if (WRITE == true) { Names.Write_name1(gameTime); if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { /// smed player1 name i database Hvis vi skal kunne huske det WRITE = false; } } base.Update(gameTime); }