public Game(UserControl userControl, Canvas drawingCanvas, Canvas debugCanvas, TextBlock txtDebug) { //Initialize IsActive = true; IsFixedTimeStep = true; TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16); Components = new List<DrawableGameComponent>(); World = new World(new Vector2(0, 0)); _gameTime = new GameTime(); _gameTime.GameStartTime = DateTime.Now; _gameTime.FrameStartTime = DateTime.Now; _gameTime.ElapsedGameTime = TimeSpan.Zero; _gameTime.TotalGameTime = TimeSpan.Zero; //Setup Canvas DrawingCanvas = drawingCanvas; DebugCanvas = debugCanvas; TxtDebug = txtDebug; UserControl = userControl; //Setup GameLoop _gameLoop = new Storyboard(); _gameLoop.Completed += GameLoop; _gameLoop.Duration = TargetElapsedTime; DrawingCanvas.Resources.Add("gameloop", _gameLoop); }
public void Update(float playerSpeed, GameTime gameTime) { float delta = playerSpeed * gameTime.UpdateTime; var centerX = this.Center.X; var centerY = this.Center.Y; var targetX = this.Target.Position.X * 32; var targetY = this.Target.Position.Y * 32; if (targetX >= this.StationaryBounds.X) { var mapBoundsX = (ServiceLocator.WorldManager.MapManager.Map.Width * 32) - (this.ViewRect.Width / 2); if (CanViewOutside || targetX <= mapBoundsX) { if (this.Center.X < targetX) { centerX += delta; if (centerX > targetX) centerX = targetX; } if (this.Center.X > targetX) { centerX -= delta; if (centerX < targetX) centerX = targetX; } } } if (targetY >= this.StationaryBounds.Y) { var mapBoundsY = (ServiceLocator.WorldManager.MapManager.Map.Height * 32) - (this.ViewRect.Height / 2); if (CanViewOutside || targetY <= mapBoundsY) { if (this.Center.Y < targetY) { centerY += delta; if (centerY > targetY) centerY = targetY; } if (this.Center.Y > targetY) { centerY -= delta; if (centerY < targetY) centerY = targetY; } } } this.Center = new Vector2f(centerX, centerY); }
public void Update(GameTime gameTime, Keys k, Keys p) { if (Playertype == 0) { KeyboardState currentKeyboardState = Keyboard.GetState(); if (currentKeyboardState.IsKeyDown(k)) // getal geeft bewegingssnelheid aan. k is voor omlaag bewegen. { Position.Y += 6; } else if (currentKeyboardState.IsKeyDown(p)) // getal geeft bewegingssnelheid aan. p is voor omhoog bewegen. { Position.Y -= 6; } } else if (Playertype == 1) { for (int i = 0; i <= 5; i++) { if (this.MiddlePaddle > Pong.getGameState.PlayingBall.MiddleBall) { Position.Y -= 1; } else if (this.MiddlePaddle < Pong.getGameState.PlayingBall.MiddleBall) { Position.Y += 1; } } } BoundsPaddle.X = (int)Position.X; BoundsPaddle.Y = (int)Position.Y; }
public override void Update(GameTime gameTime) { if (mouseDelta == Vector2.Zero) return; Vector3 cameraDirection = camera.Direction; float length = cameraDirection.Length(); cameraDirection.Normalize(); Vector3 cameraNormalDirection = Vector3.Cross(camera.UpVector, cameraDirection); Vector3 cameraTargetNormalDirectionUp = Vector3.Cross(cameraDirection, cameraNormalDirection); cameraTargetNormalDirectionUp.Normalize(); Vector3 newTargetRelative = cameraDirection; if (mouseDelta.X != 0) newTargetRelative -= cameraNormalDirection * mouseDelta.X * mouseSensivity * 1.0f / gameTime.ElapsedMiliseconds; if (mouseDelta.Y != 0) newTargetRelative -= cameraTargetNormalDirectionUp * mouseDelta.Y * mouseSensivity * mouseYInverted * 1.0f/gameTime.ElapsedMiliseconds; newTargetRelative = Vector3.Multiply(newTargetRelative, length); camera.Target = camera.Position + newTargetRelative; Cursor.Position = Master.I.form.PointToScreen(new Point(Master.I.form.ClientSize.Width / 2, Master.I.form.ClientSize.Height / 2)); Cursor.Hide(); mouseDelta = Vector2.Zero; }
public override void Draw(GameTime gameTime) { if (isVisible) { //create effect object //create orthographic projection matrix (basically discards Z value of a vertex) Matrix projection = Matrix.CreateOrthographicOffCenter(0.0f, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height, 0.0f, 0.1f, 10.0f); //set effect properties be.Projection = projection; be.View = Matrix.Identity; be.World = Matrix.Identity; //be.VertexColorEnabled = true; //change viewport to fit desired grid GraphicsDevice.Viewport = new Viewport(gridrect); //set vertex/pixel shaders from the effect be.Techniques[0].Passes[0].Apply(); //draw the lines GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, vlines, 0, xC + 1); GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, hlines, 0, yC + 1); } base.Draw(gameTime); }
public override void Update(GameTime gameTime) { if (Updates) { foreach (Entity e in Entities) e.Update(gameTime, Entities[2] as FlyingDisc); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); MouseState mouseState = Mouse.GetState(); deltaMousePos = new Point(mouseState.X - mousePosition.X, mouseState.Y - mousePosition.Y); mousePosition.X = mouseState.X; mousePosition.Y = mouseState.Y; deltaScroll = mouseState.ScrollWheelValue - mouseScrollValue; mouseScrollValue = mouseState.ScrollWheelValue; leftMouseDown = mouseState.LeftButton == ButtonState.Pressed; rightMouseDown = mouseState.RightButton == ButtonState.Pressed; prevState = curState; curState = Keyboard.GetState(); int posX = (curState.IsKeyDown(Keys.D) || curState.IsKeyDown(Keys.Right)) ? 1 : 0; int negX = (curState.IsKeyDown(Keys.A) || curState.IsKeyDown(Keys.Left)) ? -1 : 0; int posY = (curState.IsKeyDown(Keys.W) || curState.IsKeyDown(Keys.Up)) ? 1 : 0; int negY = (curState.IsKeyDown(Keys.S) || curState.IsKeyDown(Keys.Down)) ? -1 : 0; movementDir = new Vector2(posX + negX, posY + negY); if (movementDir != Vector2.Zero) movementDir.Normalize(); spaceBarPressed = curState.IsKeyDown(Keys.Space) && prevState.IsKeyUp(Keys.Space); shiftDown = curState.IsKeyDown(Keys.LeftShift) || curState.IsKeyDown(Keys.RightShift); shiftUp = curState.IsKeyUp(Keys.LeftShift) && curState.IsKeyUp(Keys.RightShift); enterDown = curState.IsKeyDown(Keys.Enter); escapeDown = curState.IsKeyDown(Keys.Escape); }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (waitTime > 0) //Als hij moet wachten voor het draaien { waitTime -= (float)gameTime.ElapsedGameTime.TotalSeconds; if (waitTime <= 0.0f) TurnAround(); } else { TileField tiles = GameWorld.Find("tiles") as TileField; float posX = this.BoundingBox.Left; if (!Mirror) posX = this.BoundingBox.Right; int tileX = (int)Math.Floor(posX / tiles.CellWidth); int tileY = (int)Math.Floor(position.Y / tiles.CellHeight); //Hij moet wachten als hij aan het einde is van zijn plankje en dan moet hij zich omdraaien if (tiles.GetTileType(tileX, tileY - 1) == TileType.Normal || tiles.GetTileType(tileX, tileY) == TileType.Background) { waitTime = 0.5f; velocity.X = 0.0f; } } this.CheckPlayerCollision(); }
public override void Draw(GameTime gameTime) { spriteBatch.Begin(); spriteBatch.Draw(lose, new Vector2(0, 0), Color.White); spriteBatch.End(); base.Draw(gameTime); }
/// <summary> /// Draws the menu. /// </summary> public override void Draw(GameTime gameTime) { // make sure our entries are in the right place before we draw them UpdateMenuEntryLocations(); SpriteBatch spriteBatch = ScreenManager.SpriteBatch; SpriteFont font = ScreenManager.Fonts.MenuSpriteFont; spriteBatch.Begin(); // Draw each menu entry in turn. for (int i = 0; i < _menuEntries.Count; ++i) { bool isSelected = IsActive && (i == _selectedEntry); _menuEntries[i].Draw(); } // Make the menu slide into place during transitions, using a // power curve to make things look more interesting (this makes // the movement slow down as it nears the end). Vector2 transitionOffset = new Vector2(0f, (float)Math.Pow(TransitionPosition, 2) * 100f); spriteBatch.DrawString(font, _menuTitle, _titlePosition - transitionOffset + Vector2.One * 2f, Color.Black, 0, _titleOrigin, 1f, SpriteEffects.None, 0); spriteBatch.DrawString(font, _menuTitle, _titlePosition - transitionOffset, new Color(255, 210, 0), 0, _titleOrigin, 1f, SpriteEffects.None, 0); _scrollUp.Draw(); _scrollSlider.Draw(); _scrollDown.Draw(); spriteBatch.End(); }
public void Draw(GameTime gameTime, SpriteBatch spriteBatch) { this.CurrentCampaign.Draw( gameTime.ElapsedGameTime, gameTime.TotalGameTime, gameTime.IsRunningSlowly); }
public void Update(GameTime gameTime) { this.CurrentCampaign.Update( gameTime.ElapsedGameTime, gameTime.TotalGameTime, gameTime.IsRunningSlowly); }
public void Update(GameTime t) { ConstructionBuilding target = this.Destination as ConstructionBuilding; if (target != null) { // arrived at destination if (path.Count == 0) { // work on current target building target.ConstructionTime -= (float)t.ElapsedGameTime.TotalSeconds; if (target.ConstructionTime <= 0) { // request moving to idle list BunkaGame.ConstructionManager.MoveToIdle(this); // signal that construction is finished BunkaGame.ConstructionManager.CompleteConstruction(target); // reset target this.Destination = null; this.path = null; } } else { UpdateAimAndVelocity(); this.Position += this.Aim * this.Velocity; } } }
/// <summary> /// Executes enqueued commands. Updates delayed commands. /// </summary> /// <param name="gameTime"></param> public void ExecuteQueue( GameTime gameTime, bool forceDelayed = false ) { var delta = (int)gameTime.Elapsed.TotalMilliseconds; lock (lockObject) { delayed.Clear(); while (queue.Any()) { var cmd = queue.Dequeue(); if (cmd.Delay<=0 || forceDelayed) { // execute : cmd.Execute(); // push to history : if (!cmd.NoRollback) { history.Push( cmd ); } } else { cmd.Delay -= delta; delayed.Enqueue( cmd ); } } Misc.Swap( ref delayed, ref queue ); } }
protected void Animate(GameTime gTime) { if (MovingDirection.X>0) sprite.Texture = textur; else sprite.Texture = textur2; }
private double tide_ft; // Measurement in feet (convert to meter -> tide_mt = tide_ft * 0.3048) // Period (p): horizontal distance before the y-axis begins to repeat // Frequency (f): number of complete waves for a given time Period // p = 2pi/f void Awake () { gameTime = GameObject.Find("HUDGameTime").GetComponent<GameTime>(); water_Y_axis = water.GetComponent<Transform>(); rand = new System.Random(); frequency = (2.619278 + 0.5 * Math.PI) / 8; }
protected virtual void HandleInput(GameTime gameTime) { keyState = Keyboard.GetState(); Vector2 force = Vector2.Zero; if (keyState.IsKeyDown(Keys.A)) { force.X -= forcePower * (float)gameTime.ElapsedGameTime.TotalSeconds; } if (keyState.IsKeyDown(Keys.D)) { force.X += forcePower * (float)gameTime.ElapsedGameTime.TotalSeconds; } if (keyState.IsKeyDown(Keys.W)) { force.Y -= forcePower * (float)gameTime.ElapsedGameTime.TotalSeconds; } if (keyState.IsKeyDown(Keys.S)) { force.Y += forcePower * (float)gameTime.ElapsedGameTime.TotalSeconds; } body.ApplyLinearImpulse(force, body.Position); //oldState = keyState; }
/// <summary>Update the turtle.</summary> public override void Update(GameTime gameTime) { base.Update(gameTime); if (sneezeTime > 0) { PlayAnimation("sneeze"); sneezeTime -= (float)gameTime.ElapsedGameTime.TotalSeconds; if (sneezeTime <= 0.0f) { idleTime = 5.0f; sneezeTime = 0.0f; } } else if (idleTime > 0) { PlayAnimation("idle"); idleTime -= (float)gameTime.ElapsedGameTime.TotalSeconds; if (idleTime <= 0.0f) { idleTime = 0.0f; sneezeTime = 5.0f; } } CheckCollisions(); }
public override void Update(GameTime gameTime) { base.Update(gameTime); //Update position from parent WorldPosition = Parent.Position; }
public override void Draw(GameTime gameTime) { ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, Camera.View); for (int i = 0; i < _softBodies.Count; ++i) { ScreenManager.SpriteBatch.Draw(_softBodyBox.Texture, ConvertUnits.ToDisplayUnits(_softBodies[i].Position), null, Color.White, _softBodies[i].Rotation, _softBodyBox.Origin, 1f, SpriteEffects.None, 0f); } for (int i = 0; i < _softBodies.Count; ++i) { ScreenManager.SpriteBatch.Draw(_softBodyCircle.Texture, ConvertUnits.ToDisplayUnits(_softBodies[i].Position), null, Color.White, _softBodies[i].Rotation, _softBodyCircle.Origin, 1f, SpriteEffects.None, 0f); } for (int i = 0; i < _bridgeBodies.Count; ++i) { ScreenManager.SpriteBatch.Draw(_bridgeBox.Texture, ConvertUnits.ToDisplayUnits(_bridgeBodies[i].Position), null, Color.White, _bridgeBodies[i].Rotation, _bridgeBox.Origin, 1f, SpriteEffects.None, 0f); } ScreenManager.SpriteBatch.End(); _border.Draw(); base.Draw(gameTime); }
public void Update(GameTime gameTime) { currentTime = (float)gameTime.TotalGameTime.TotalMilliseconds; deltaTime = currentTime - lastTime; lastTime = currentTime; myFPS = (int)(1.0 / (.001 * deltaTime)); }
/// <summary>Updatethe button.</summary> public override void Update(GameTime gameTime) { base.Update(gameTime); spr_lock.Visible = level.Locked; levels_solved.Visible = level.Solved; levels_unsolved.Visible = !level.Solved; }
static void Initialize() { if (!theGameTime) { GameObject go = new GameObject("GameTime"); theGameTime = go.AddComponent(typeof(GameTime)) as GameTime; } }
protected override void Draw(GameTime time) { base.Draw(time); GraphicsDevice.Clear(new Color(32, 32, 32, 0)); Sprite.Begin(SpriteSortMode.Deferred, GraphicsDevice.BlendStates.NonPremultiplied); Sprite.DrawString(font, "FPS: " + FPS.ToString("#"), new Vector2(10, 10), Color.Lime); Sprite.DrawString(font, "Keyboard: " + Keyboard, new Vector2(10, 40), Color.Gray); Sprite.DrawString(font, "Mouse: " + Mouse, new Vector2(10, 70), Color.Gray); Sprite.DrawString(font, "Window: " + Width + "x" + Height, new Vector2(10, 100), Color.Gray); effect.VertexColorEnabled = true; effect.CurrentTechnique.Passes[0].Apply(); lineVertex.Begin(); lineVertex.DrawLine( new VertexPositionColor(new Vector3(50, 0, 0), Color.White), new VertexPositionColor(new Vector3(-50, 0, 0), Color.White)); lineVertex.DrawLine( new VertexPositionColor(new Vector3(0, 50, 0), Color.Red), new VertexPositionColor(new Vector3(0, -50, 0), Color.Red)); lineVertex.End(); Sprite.End(); }
public void Draw(GameTime dt) { Game.Game.Sprites.Begin(); Game.Game.Sprites.Draw(background, new Rectangle(0, 0, sizex, sizey), Color.White); Game.Game.Sprites.End(); }
public Effect(GameTime gameTime, Vector2 position, EffectPosition height, VGame.Shape shape) { _position = position; Height = height; Shape = shape; ExpirationTime = gameTime.TotalGameTime + Duration; }
public override void Draw(GameTime gameTime) { spriteBatch.Begin(); spriteBatch.Draw(texture, playerBody.Position, null, Color.White, playerBody.Rotation, new Vector2(WIDTH, HEIGHT) / 2.0f, 1.0f, SpriteEffects.None, 0.0f); spriteBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime aGameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); theFileManager.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); theScreenManager.Draw(aGameTime); theFileManager.SpriteBatch.End(); }
public override void Draw( GameTime gameTime ) { ScreenManager.SpriteBatch.Begin( 0, null, null, null, null, null, Camera.View ); // draw car ScreenManager.SpriteBatch.Draw( _wheel.Texture, ConvertUnits.ToDisplayUnits( _wheelBack.Position ), null, Color.White, _wheelBack.Rotation, _wheel.Origin, _scale, SpriteEffects.None, 0f ); ScreenManager.SpriteBatch.Draw( _wheel.Texture, ConvertUnits.ToDisplayUnits( _wheelFront.Position ), null, Color.White, _wheelFront.Rotation, _wheel.Origin, _scale, SpriteEffects.None, 0f ); ScreenManager.SpriteBatch.Draw( _carBody.Texture, ConvertUnits.ToDisplayUnits( _car.Position ), null, Color.White, _car.Rotation, _carBody.Origin, _scale, SpriteEffects.None, 0f ); // draw teeter ScreenManager.SpriteBatch.Draw( _teeter.Texture, ConvertUnits.ToDisplayUnits( _board.Position ), null, Color.White, _board.Rotation, _teeter.Origin, 1f, SpriteEffects.None, 0f ); // draw bridge for ( int i = 0; i < _bridgeSegments.Count; ++i ) { ScreenManager.SpriteBatch.Draw( _bridge.Texture, ConvertUnits.ToDisplayUnits( _bridgeSegments[ i ].Position ), null, Color.White, _bridgeSegments[ i ].Rotation, _bridge.Origin, 1f, SpriteEffects.None, 0f ); } // draw boxes for ( int i = 0; i < _boxes.Count; ++i ) { ScreenManager.SpriteBatch.Draw( _box.Texture, ConvertUnits.ToDisplayUnits( _boxes[ i ].Position ), null, Color.White, _boxes[ i ].Rotation, _box.Origin, 1f, SpriteEffects.None, 0f ); } // draw ground ScreenManager.SpriteBatch.Draw( _groundTex, ConvertUnits.ToDisplayUnits( _ground.Position ), null, Color.White, _ground.Rotation, _groundOrigin, _mapScale, SpriteEffects.None, 0f ); ScreenManager.SpriteBatch.End(); base.Draw( gameTime ); }
/// <summary> /// Draws the objects in the list /// </summary> /// <param name="gameTime">The object used for reacting to timechanges</param> /// <param name="spriteBatch">The SpriteBatch</param> public override void Draw(GameTime gameTime, SpriteBatch spriteBatch) { if (!visible) return; foreach(GameObject obj in gameObjects) obj.Draw(gameTime, spriteBatch); }
/// <summary> /// Allows the game screen to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> public virtual void Update(GameTime gameTime) { if (showAvatar) { userAvatar.Update(gameTime); if (!IsFrozen) { if (enablePause) { if (userAvatar.Avatar == userAvatar.AllAvatars[0]) { //Freeze Screen, Show pause Screen\ screenPaused = true; ScreenManager.AddScreen(new PauseScreen()); this.FreezeScreen(); } else if (userAvatar.Avatar.Equals(userAvatar.AllAvatars[2]) && screenPaused == true) { //exit pause screen, unfreeze screen this.UnfreezeScreen(); } } } } if (frameNumber % 360 == 0 && voiceCommands != null) { voiceCommands.HeardString = ""; } var currSkel = screenManager.Kinect.trackedSkeleton; int?currId = null; if (currSkel != null) { currId = currSkel.TrackingId; } if (lastSkelId != currId) { depthTimer = 2; lastSkelId = currId; } if (depthTimer > 0) { depthTimer -= gameTime.ElapsedGameTime.TotalSeconds; } frameNumber++; if (voiceCommands != null) { switch (voiceCommands.HeardString) { case "One": if (ScreenManager.Kinect.devices[0].IsSwitchedOn) { ScreenManager.Kinect.devices[0].switchOff(ScreenManager.Kinect.comm); } else { ScreenManager.Kinect.devices[0].switchOn(ScreenManager.Kinect.comm); } //this.FreezeScreen(); screenManager.AddScreen(new PauseScreen(ScreenManager.Kinect.devices[0].Name + " is " + ScreenManager.Kinect.devices[0].Status, 300)); voiceCommands.HeardString = ""; break; /* case "Open": * if (ScreenManager.Kinect.devices[1].IsSwitchedOn) * ScreenManager.Kinect.devices[1].switchOff(ScreenManager.Kinect.comm); * else * ScreenManager.Kinect.devices[1].switchOn(ScreenManager.Kinect.comm); * screenManager.AddScreen(new PauseScreen(ScreenManager.Kinect.devices[1].Name + " is " + ScreenManager.Kinect.devices[1].Status,300)); * //this.FreezeScreen(); * voiceCommands.HeardString = ""; * break; * */ //case "volume up": // MediaPlayer.Volume++; // voiceCommands.HeardString=""; // break; //case "volume down": // MediaPlayer.Volume--; // voiceCommands.HeardString = ""; // break; default: break; } } }
protected override void Draw(GameTime gameTime) { if (pauseOnFocusLost && !IsActive) { return; } #if DEBUG TimeRuler.instance.beginMark("draw", Color.Gold); #endif if (_sceneTransition != null) { _sceneTransition.preRender(Graphics.instance); } if (_scene != null) { _scene.preRender(); _scene.render(); #if DEBUG if (debugRenderEnabled) { Debug.render(); } #endif // render as usual if we dont have an active SceneTransition if (_sceneTransition == null) { _scene.postRender(); } } // special handling of SceneTransition if we have one if (_sceneTransition != null) { if (_scene != null && _sceneTransition.wantsPreviousSceneRender && !_sceneTransition.hasPreviousSceneRender) { _scene.postRender(_sceneTransition.previousSceneRender); scene = null; startCoroutine(_sceneTransition.onBeginTransition()); } else { if (_scene != null) { _scene.postRender(); } } _sceneTransition.render(Graphics.instance); } #if DEBUG TimeRuler.instance.endMark("draw"); if (DebugConsole.instance.isOpen) { DebugConsole.instance.render(); } else { TimeRuler.instance.render(); } #endif }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } MouseLocation = new Vector2(Mouse.GetState().X, Mouse.GetState().Y); newMouse = Mouse.GetState(); newKeyboardState = Keyboard.GetState(); #region input if (newKeyboardState.IsKeyDown(Keys.S)) //testing script { if (!oldKeyboardState.IsKeyDown(Keys.S)) { // conversationController.startConv("help"); characterController.AllCharacters.Clear(); } } else if (oldKeyboardState.IsKeyDown(Keys.S)) { //nothing } if (newMouse.LeftButton == ButtonState.Pressed && oldMouse.LeftButton == ButtonState.Released) { int MapRow = (int)(MouseLocation.X / Constants.MapSquareSize); int MapCol = (int)(MouseLocation.Y / Constants.MapSquareSize); //IsDisplayingMoveRange = false; /* * foreach (Character c in PlayerCharacters) * { * if (Movement.testInputIsWithinMapBounds(MapRow, MapCol, mapController.Maps.ElementAt(mapController.CurrentMap))) * { * if (c.HasMove && c.Location.X == MapRow && c.Location.Y == MapCol) * { * Movement.calculateMovementRange((int)c.Location.X, (int)c.Location.Y, c.TotalModifier.MoveRange, mapController.Maps.ElementAt(mapController.CurrentMap), c); * IsDisplayingMoveRange = true; * selectCharacter(c); * break; * } * else if (c.Selected && IsDisplayingMoveRange && !isCharacterAt(MapRow, MapCol) && mapController.Maps.ElementAt(mapController.CurrentMap).map2DArray[MapRow][MapCol].inRangeFlag == 1) * { * c.moveToLocation(MapRow, MapCol); * IsDisplayingMoveRange = false; * c.Selected = false; * c.HasMove = false; * break; * } * else if (isCharacterAt(MapRow, MapCol) || mapController.Maps.ElementAt(mapController.CurrentMap).map2DArray[MapRow][MapCol].inRangeFlag != 1) * { * IsDisplayingMoveRange = false; * } * } * }*/ //if (situationController.AllowCharacterMovement) //{ .movementInput(situationController, mapController, characterController, MapRow, MapCol, mapController.getCurrentMap(), ref IsDisplayingMoveRange); } } #endregion /*if (turnCompleted()) * { * nextTurn(); * }*/ //turn logic //situationController.inputLogic(mapController, characterController, conversationController, Content, spriteBatch); situationController.tryNextTurn(characterController); CharacterMenu.Input(characterController.AllCharacters, oldMouse); /*if (InputMethods.checkIfMouseClickInBounds(OldMouse, new Vector2(0, 0), new Vector2(100, 100), (int)Constants.MouseButtons.Middle)) * { * Console.Write("youpressedit"); * }*/ oldKeyboardState = newKeyboardState; //necissary for functionality oldMouse = newMouse; // TODO: Add your update logic here //testConv.start(); //testConv.input(); //ConvController.Input(); //conversationController.Input(); base.Update(gameTime); }
public override void PostUpdate(GameTime gameTime) { base.PostUpdate(gameTime); CheckSeedPickups(gameTime); }
public override void Draw(GameTime time) { sb.Begin(); switch (end) { case Ending.Airlock: sb.Draw(space, space.Bounds, Color.White); sb.Draw(airlockEnd, airlockEnd.Bounds, Color.White); break; case Ending.Banjo: sb.Draw(space, space.Bounds, Color.White); sb.Draw(banjoEnd, banjoEnd.Bounds, Color.White); break; case Ending.Bathroom: sb.Draw(space, space.Bounds, Color.White); sb.Draw(blackhole, blackhole.Bounds, Color.White); break; case Ending.Thrusters: sb.Draw(space, space.Bounds, Color.White); sb.Draw(thrusters, thrusters.Bounds, Color.White); break; case Ending.Help: tut = true; if (first2) { sec2 = time.TotalGameTime.TotalMilliseconds; first2 = false; } sb.Draw(space, space.Bounds, Color.White); if ((Mouse.GetState().LeftButton == ButtonState.Pressed || Mouse.GetState().RightButton == ButtonState.Pressed || Mouse.GetState().MiddleButton == ButtonState.Pressed || Keyboard.GetState().GetPressedKeys().Length > 0) && (time.TotalGameTime.TotalMilliseconds > sec2 + 250 || here)) { sb.Draw(help, tutorial.Bounds, Color.White); here = true; tut = false; } else { if (here) { sb.Draw(help, tutorial.Bounds, Color.White); } else { sb.Draw(tutorial, help.Bounds, Color.White); } } break; case Ending.Inaction: sb.Draw(space, space.Bounds, Color.White); sb.Draw(inactive, inactive.Bounds, Color.White); break; case Ending.Reverse: sb.Draw(space, space.Bounds, Color.White); sb.Draw(breaks, breaks.Bounds, Color.White); break; case Ending.Dubstep: sb.Draw(space, space.Bounds, Color.White); sb.Draw(dub, dub.Bounds, Color.White); break; } sb.End(); }
public override void Update(GameTime gameTime) { // Not used with this sprite }
/// <summary> /// 更新 /// </summary> /// <param name="gameTime">ゲーム時間</param> public void Update(GameTime gameTime) { //デバイスで絶対に1回のみ更新が必要なモノ Input.Update(); this.gameTime = gameTime; }
protected override void OnUpdate(GameTime gameTime) { base.OnUpdate(gameTime); var theaterDays = Game.AsTheaterDays(); var audio = theaterDays.FindSingleElement <AudioController>(); var video = theaterDays.FindSingleElement <BackgroundVideo>(); if (SyncTarget == TimerSyncTarget.Auto) { var timeFilled = false; if (!timeFilled) { if (audio?.Music != null) { CurrentTime = audio.Music.CurrentTime; timeFilled = true; } } if (!timeFilled) { if (video != null) { CurrentTime = video.CurrentTime; timeFilled = true; } } if (!timeFilled) { CurrentTime = gameTime.Total; } } else { switch (SyncTarget) { case TimerSyncTarget.Audio: if (audio?.Music != null) { CurrentTime = audio.Music.CurrentTime; } break; case TimerSyncTarget.Video: if (video != null) { CurrentTime = video.CurrentTime; } break; case TimerSyncTarget.GameTime: CurrentTime = gameTime.Total; break; default: throw new ArgumentOutOfRangeException(); } } }
public override void Update(GameTime gameTime, InputManager input, Collision col, Layer layer) { base.Update(gameTime, input, col, layer); moveAnimation.DrawColor = Color.White; moveAnimation.IsActive = true; //BULLETS if (input.KeyPressed(Keys.Space)) { Bullet bullet = new Bullet(); bullet.position.Y = position.Y; if (moveAnimation.CurrentFrame.Y == 0) { bullet.direction = true; bullet.position.X = position.X + 32; } else { bullet.direction = false; bullet.position.X = position.X - 10; } bullets.Add(bullet); } if (input.KeyDown(Keys.LeftShift)) { time = false; } else { time = true; } if (time) { for (int i = 0; i < bullets.Count; i++) { float x = bullets[i].position.X; if (bullets[i].direction) { x += bulletSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; } else { x -= bulletSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; } bullets[i].position = new Vector2(x, bullets[i].position.Y); } } if (input.KeyDown(Keys.Right, Keys.D)) { moveAnimation.CurrentFrame = new Vector2(moveAnimation.CurrentFrame.X, 0); velocity.X = moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; } else if (input.KeyDown(Keys.Left, Keys.A)) { moveAnimation.CurrentFrame = new Vector2(moveAnimation.CurrentFrame.X, 1); velocity.X = -moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; } else { moveAnimation.IsActive = false; velocity.X = 0; } if (input.KeyDown(Keys.Up, Keys.W) && !activateGravity) { activateGravity = true; velocity.Y = -jumpSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; } if (activateGravity) { velocity.Y += gravity * (float)gameTime.ElapsedGameTime.TotalSeconds; } else { velocity.Y = 0; } position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds; moveAnimation.Position = position; ssAnimation.Update(gameTime, ref moveAnimation); Camera.Instance.SetFocalPoint(new Vector2(Position.X, ScreenManager.Instance.Dimensions.Y / 2)); }
public override void Update(GameTime gameTime, Map gameMap) { _target.X = Position.X + (_faceDir * 200); //if (_target.X < 0) _target.X = (gameMap.Width * gameMap.TileWidth) - _target.X; //if (_target.X >= (gameMap.Width * gameMap.TileWidth)) _target.X = _target.X - (gameMap.Width * gameMap.TileWidth); if (Helper.Random.Next(100) == 0) { _target.Y = Helper.RandomFloat(30f, (gameMap.TileHeight * gameMap.Height) - 30f); } //if (Helper.Random.Next(500) == 0) // _faceDir = -_faceDir; for (int dist = 0; dist <= 150; dist += 50) { if (gameMap.CheckTileCollision(new Vector2(_target.X + (dist * -_faceDir), Position.Y))) { _target.Y = Position.Y + (Position.Y < 260f ? -50f : 50f); Speed.X = MathHelper.Lerp(Speed.X, 0f, 0.1f); } } //if (gameMap.CheckTileCollision(_target + new Vector2(-_faceDir * 50, 0))) //{ // _target.Y += _target.Y < 260f ? -50f : 50f; // Speed.X = MathHelper.Lerp(Speed.X, 0f, 0.1f); //} //if (gameMap.CheckTileCollision(_target + new Vector2(-_faceDir * 100, 0))) //{ // _target.Y += _target.Y < 260f ? -50f : 50f; // Speed.X = MathHelper.Lerp(Speed.X, 0f, 0.1f); //} //if (gameMap.CheckTileCollision(_target + new Vector2(-_faceDir * 130, 0))) //{ // _target.Y += _target.Y < 260f ? -50f : 50f; // Speed.X = MathHelper.Lerp(Speed.X, 0f, 0.1f); //} //if (Speed.Length() < 0.1f) _target = Position; //Rotation = Helper.V2ToAngle(Speed); Speed = Vector2.Lerp(Speed, Vector2.Zero, 0.05f); if (Vector2.Distance(_target, Position) > 5f) { Vector2 dir = _target - Position; dir.Normalize(); Speed += dir * 0.2f; } Speed.X = MathHelper.Clamp(Speed.X, -3f, 3f); Speed.Y = MathHelper.Clamp(Speed.Y, -3f, 3f); if (Position.Y < 260f) { ParticleController.Instance.Add(Position + new Vector2(-_faceDir * 5f, 0f), new Vector2(Helper.RandomFloat(0f, -_faceDir * 1f), Helper.RandomFloat(-0.2f, 0.2f)), 0, Helper.RandomFloat(500, 1000), 500, false, true, Position.Y < 260f ?new Rectangle(0, 0, 3, 3):new Rectangle(128, 0, 16, 16), new Color(new Vector3(1f) * (0.5f + Helper.RandomFloat(0.5f))), ParticleFunctions.Smoke, Position.Y >= 260f ? 0.3f : 1f, 0f, Helper.RandomFloat(-0.1f, 0.1f), 0, ParticleBlend.Alpha); } ParticleController.Instance.Add(Position + new Vector2(-_faceDir * 5f, 0f), new Vector2(Helper.RandomFloat(0f, -_faceDir * 0.2f), Helper.RandomFloat(-0.2f, 0.2f)), 0, Helper.RandomFloat(50, 150), 50, false, true, Position.Y < 260f ? new Rectangle(0, 0, 3, 3) : new Rectangle(128, 0, 16, 16), Position.Y < 260f ? Color.LightGreen : Color.White, ParticleFunctions.FadeInOut, Position.Y >= 260f ? 0.3f : 1f, 0f, Helper.RandomFloat(-0.1f, 0.1f), 0, ParticleBlend.Alpha); projectileTime -= gameTime.ElapsedGameTime.TotalMilliseconds; if (_firing) { Vector2 screenPos = Vector2.Transform(Position, Camera.Instance.CameraMatrix); float pan = (screenPos.X - (Camera.Instance.Width / 2f)) / (Camera.Instance.Width / 2f); if (pan < -1f || pan > 1f) { gunLoop.Volume = 0f; } else { gunLoop.Volume = 0.3f; } if (Ship.Instance.Position.Y >= 260 && Position.Y < 260) { gunLoop.Volume = 0f; } if (Ship.Instance.Position.Y < 260 && Position.Y >= 260) { gunLoop.Volume = 0f; } gunLoop.Pan = MathHelper.Clamp(pan, -1f, 1f); if (projectileTime <= 0) { projectileTime = projectileCoolDown; ProjectileController.Instance.Spawn(entity => { ((Projectile)entity).Type = ProjectileType.Forward1; ((Projectile)entity).SourceRect = new Rectangle(8, 8, 20, 8); ((Projectile)entity).Life = 1000; ((Projectile)entity).EnemyOwner = true; ((Projectile)entity).Damage = 1f; entity.Speed = new Vector2(6f * _faceDir, 0f); entity.Position = Position + entity.Speed; }); } if (Helper.Random.Next(20) == 0) { _firing = false; gunLoop.Pause(); } } else { if (Helper.Random.Next(50) == 0) { _firing = true; gunLoop.Resume(); } } if (Helper.Random.Next(200) == 0 && GameController.Wave >= 8) { AudioController.PlaySFX("seeker", 0.5f, -0.1f, 0.1f, Camera.Instance, Position); ProjectileController.Instance.Spawn(entity => { ((Projectile)entity).Type = ProjectileType.Seeker; ((Projectile)entity).SourceRect = new Rectangle(1, 18, 8, 4); ((Projectile)entity).Life = 2000; ((Projectile)entity).Scale = 1f; ((Projectile)entity).EnemyOwner = true; ((Projectile)entity).Damage = 5f; ((Projectile)entity).Target = Position + new Vector2(_faceDir * 300, 0); ; entity.Speed = new Vector2(0f, -0.5f); entity.Position = Position + new Vector2(0, 0); }); } //if (Vector2.Distance(Position, _target) < 1f) //{ // _idleAnim.Pause(); // _hitAnim.Pause(); // if (Helper.Random.Next(100) == 0) // { // _target = Position + new Vector2(Helper.RandomFloat(-30, 30), Helper.RandomFloat(-30, 30)); // if (_target.Y < 280) _target.Y = 280; // Vector2 dir = _target - Position; // dir.Normalize(); // Speed = dir*5f; // _idleAnim.Play(); // _hitAnim.Play(); // } // if (Vector2.Distance(Ship.Instance.Position, Position) < 100f) // { // _target = Ship.Instance.Position; // if (_target.Y < 280) _target.Y = 280; // Vector2 dir = _target - Position; // dir.Normalize(); // Speed = dir * 5f; // _idleAnim.Play(); // _hitAnim.Play(); // } //} //else //{ // ParticleController.Instance.Add(Position, // new Vector2(Helper.RandomFloat(-0.1f,0.1f), Helper.RandomFloat(-0.1f,0.1f)), // 0, Helper.Random.NextDouble() * 1000, Helper.Random.NextDouble() * 1000, // false, false, // new Rectangle(128, 0, 16, 16), // new Color(new Vector3(1f) * (0.25f + Helper.RandomFloat(0.5f))), // ParticleFunctions.FadeInOut, // 0.5f, 0f, 0f, // 1, ParticleBlend.Alpha); //} base.Update(gameTime, gameMap); }
static public void Update(GameTime gameTime, GraphicsDevice graphics) { KeyboardState kb = Keyboard.GetState(); MouseState mouseState = Mouse.GetState(); if (tipoCamera == TipoCamera.SurfaceFollow || tipoCamera == TipoCamera.Free) { //Controlos do teclado if (kb.IsKeyDown(Keys.W)) { Foward(); } if (kb.IsKeyDown(Keys.S)) { Backward(); } if (kb.IsKeyDown(Keys.A)) { strafeLeft(gameTime, moveSpeed / 2); } if (kb.IsKeyDown(Keys.D)) { strafeRight(gameTime, moveSpeed / 2); } if (kb.IsKeyDown(Keys.Q)) { Up(); } if (kb.IsKeyDown(Keys.E)) { Down(); } if (mouseState.ScrollWheelValue > mouseStateAnterior.ScrollWheelValue) { if (moveSpeed < 2f) { moveSpeed += (mouseState.ScrollWheelValue - mouseStateAnterior.ScrollWheelValue) / 10000f; } } if (Mouse.GetState().ScrollWheelValue < mouseStateAnterior.ScrollWheelValue) { if (moveSpeed > 0.05f) { moveSpeed -= (mouseStateAnterior.ScrollWheelValue - mouseState.ScrollWheelValue) / 10000f; } } //Controlo da rotação com o rato if (mouseState != mouseStateOriginal) { mouseMoved.X = mouseState.Position.X - mouseStateOriginal.Position.X; mouseMoved.Y = mouseState.Position.Y - mouseStateOriginal.Position.Y; rotateLeftRight(); rotateUpDown(); try { Mouse.SetPosition(graphics.Viewport.Height / 2, graphics.Viewport.Width / 2); } catch (Exception e) { Console.WriteLine(e); } } } if (kb.IsKeyDown(Keys.O) && !keyStateAnterior.IsKeyDown(Keys.O)) { if (graphics.RasterizerState == rasterizerStateSolid) { graphics.RasterizerState = rasterizerStateWireFrame; currentRasterizerState = rasterizerStateWireFrame; } else { graphics.RasterizerState = rasterizerStateSolid; currentRasterizerState = rasterizerStateSolid; } } if (kb.IsKeyDown(Keys.C) && !keyStateAnterior.IsKeyDown(Keys.C)) { switch (tipoCamera) { case TipoCamera.SurfaceFollow: tipoCamera = TipoCamera.Free; break; case TipoCamera.Free: tipoCamera = TipoCamera.ThirdPerson; break; case TipoCamera.ThirdPerson: tipoCamera = TipoCamera.SurfaceFollow; break; default: tipoCamera = TipoCamera.Free; break; } } if (kb.IsKeyDown(Keys.N) && !keyStateAnterior.IsKeyDown(Keys.N)) { drawNormals = !drawNormals; } // position = LimitarCameraTerreno(position); UpdateViewMatrix(); mouseStateAnterior = mouseState; keyStateAnterior = kb; positionAnterior = position; }
public virtual void Update(GameTime gameTime, List <Sprite> sprites) { }
public abstract bool Update(GameTime gameTime, Input input);
static private void strafeRight(GameTime gameTime, float strafe) { strafe = strafe + moveSpeed * gameTime.ElapsedGameTime.Milliseconds; position = position + moveSpeed * Vector3.Cross(direction, Vector3.Up); target = position + direction; }
public override void PostUpdate(GameTime gameTime) { // remove sprites if they're not needed }
public override void Update(GameTime gameTime) { // }
/// <summary>Updates the state of all input devices</summary> /// <param name="gameTime">Not used</param> void IUpdateable.Update(GameTime gameTime) { Update(); }
public override void Update(GameTime gameTime) { spawnManager.Update(gameTime); }
/// <summary> /// Move Spacecraft by user key inputs (Up/Down/Left/Right keys) /// Fire missiles (Space key) /// </summary> /// <param name="gameTime"></param> private void UpdateUserInput(GameTime gameTime) { KeyboardState ks = Keyboard.GetState(); if (ks.IsKeyDown(Keys.Right)) { state = PlayerState.Right; Position.X += SPEED; } else if (ks.IsKeyDown(Keys.Left)) { state = PlayerState.Left; Position.X -= SPEED; } else { state = PlayerState.Idle; currentFrame = 0; } if (ks.IsKeyDown(Keys.Up)) { state = PlayerState.Idle; Position.Y -= SPEED; currentFrame = 0; } else if (ks.IsKeyDown(Keys.Down)) { state = PlayerState.Idle; Position.Y += SPEED; currentFrame = 0; } // Space Key: Shoot Missile if (ks.IsKeyDown(Keys.Space)) { // Check Shooting Time Inverval shootingTimer += gameTime.ElapsedGameTime.TotalSeconds; if(shootingTimer >= MISSILE_INTERVAL) { if (Missile.missileLevel == 0) { // Create a Missile on the top of the player Missile missile = new Missile(Game, new Vector2(Position.X + WIDTH / 2, Position.Y)); shootingTimer = 0; parent.AddComponent(missile); } else if (Missile.missileLevel == 1) { // Create a Missile on the top of the player Missile missile1 = new Missile(Game, new Vector2(Position.X, Position.Y)); Missile missile2 = new Missile(Game, new Vector2(Position.X + WIDTH, Position.Y)); shootingTimer = 0; parent.AddComponent(missile1); parent.AddComponent(missile2); } else if (Missile.missileLevel == 2) { // Create a Missile on the top of the player Missile missile1 = new Missile(Game, new Vector2(Position.X, Position.Y)); Missile missile2 = new Missile(Game, new Vector2(Position.X + WIDTH, Position.Y)); Missile missile3 = new Missile(Game, new Vector2(Position.X + WIDTH / 2, Position.Y)); shootingTimer = 0; parent.AddComponent(missile1); parent.AddComponent(missile2); parent.AddComponent(missile3); } else { // Create a Missile on the top of the player Missile missile = new Missile(Game, new Vector2(Position.X + WIDTH / 2, Position.Y)); shootingTimer = 0; parent.AddComponent(missile); } } } // Check Boundary, a player cannot go out of the screen int screenWidth = Game.GraphicsDevice.Viewport.Width; int screenHeight = Game.GraphicsDevice.Viewport.Height; Position.X = MathHelper.Clamp(Position.X, 0, screenWidth - WIDTH); Position.Y = MathHelper.Clamp(Position.Y, 0, screenHeight - HEIGHT); }
internal override void Update(GameTime gameTime) { base.Update(gameTime); switch (Stage) { case IntroStage.None: EnterStage(IntroStage.SwampFortressEnter); ChangeAudioState(AudioStage.None); break; case IntroStage.Castle: CurrentAlpha = (float)(elapsedTimeInStage / 2.5); if (CurrentAlpha > 1.0f) { CurrentAlpha = 1.0f; } if (elapsedTimeInStage >= 0.1) { ChangeAudioState(AudioStage.InTheAgeOfChaos); } if (elapsedTimeInStage >= 5.1) { ChangeAudioState(AudioStage.TheKingdomOfAzeroth); InvokeChangeMovieStatus(true); } break; case IntroStage.CastleLoop: if (elapsedTimeInStage >= 13.0) { CurrentAlpha = 1.0f - (float)((elapsedTimeInStage - 13.0) / 2.5); if (CurrentAlpha > 1.0f) { CurrentAlpha = 1.0f; } if (CurrentAlpha < 0.0f) { CurrentAlpha = 0.0f; } if (elapsedTimeInStage >= 15.5) { EnterStage(IntroStage.Swamp); } } break; case IntroStage.Swamp: CurrentAlpha = (float)(elapsedTimeInStage / 2.5); if (CurrentAlpha > 1.0f) { CurrentAlpha = 1.0f; } if (elapsedTimeInStage >= 0.1) { ChangeAudioState(AudioStage.NoOneKnewWhere); InvokeChangeMovieStatus(true); } break; case IntroStage.SwampLoop: if (elapsedTimeInStage >= 7.0) { EnterStage(IntroStage.SwampFortressEnter); } break; case IntroStage.SwampFortressEnter: if (elapsedTimeInStage >= 0.25) { ChangeAudioState(AudioStage.OpenGate); } break; case IntroStage.CaveEnter: if (elapsedTimeInStage >= 0.25) { ChangeAudioState(AudioStage.WithAnIngenious); } break; case IntroStage.CaveLoop: if (elapsedTimeInStage >= 3.3) { EnterStage(IntroStage.CaveExit); } break; case IntroStage.CaveExit: if (elapsedTimeInStage >= 0.01) { ChangeAudioState(AudioStage.WelcomeToTheWorld); } break; } }
public void Update(GameTime gameTime) { escenaActual?.Update(gameTime); }
public void Draw(GameTime gameTime) { contexto.GraphicsDevice.Clear(Color.Black); escenaActual?.Draw(gameTime); }
public IState UpdateContent(GameTime gameTime, Camera camera, ref GameSettings gameSettings) { IState nextState = this; KeyboardState keyState = Keyboard.GetState(); if (keyState.IsKeyDown(Keys.Escape) && PrevKeyboardState.IsKeyUp(Keys.Escape)) { nextState = previousState; nextState.SetPrevInput(Keyboard.GetState(), Mouse.GetState(), GamePad.GetState(PlayerIndex.One)); } else if (keyState.IsKeyDown(Keys.Up) && PrevKeyboardState.IsKeyUp(Keys.Up)) { optionSelection -= 1; if (optionSelection < 0) { optionSelection = optionsAmount - 1; } if (optionSelection >= optionsAmount) { optionSelection = 0; } while (!menuOptions[optionSelection].Enabled) { optionSelection -= 1; } } else if (keyState.IsKeyDown(Keys.Down) && PrevKeyboardState.IsKeyUp(Keys.Down)) { optionSelection += 1; if (optionSelection < 0) { optionSelection = optionsAmount - 1; } if (optionSelection >= optionsAmount) { optionSelection = 0; } while (!menuOptions[optionSelection].Enabled) { optionSelection += 1; } } else if (keyState.IsKeyDown(Keys.Enter) && PrevKeyboardState.IsKeyUp(Keys.Enter)) { switch (optionSelection) { case (int)Options.OPTIONS: GameSettingsMenuStateSpace nextStateSpace = new GameSettingsMenuStateSpace(ref gameSettings); nextState = new MenuState(nextStateSpace, camera, Content, Graphics, this, keyboardState: Keyboard.GetState()); break; case (int)Options.SAVE_TITLE: FileIO.SaveDungeonData(((PlayingState)previousState).GetSaveData()); nextState = new TitleState(camera, Content, Graphics, Mouse.GetState(), GamePad.GetState(PlayerIndex.One), keyState); break; case (int)Options.UNPAUSE: nextState = previousState; nextState.SetPrevInput(Keyboard.GetState(), Mouse.GetState(), GamePad.GetState(PlayerIndex.One)); break; } } PrevKeyboardState = Keyboard.GetState(); PrevMouseState = Mouse.GetState(); PrevGamepadState = GamePad.GetState(PlayerIndex.One); return(nextState); }
public abstract void Draw(GameTime gameTime);
//抽象メソッド群 public abstract void Update(GameTime gameTime); //更新処理
internal override void Update(GameTime time) { base.Update(time); }
public virtual void Update(GameTime gameTime) { }
public virtual void Draw(GameTime gameTime) { }
public override void Update(GameTime gameTime) { sphere.Center = position; base.Update(gameTime); }
public void Update(GameTime gameTime) { position += moveVector * (float)gameTime.ElapsedGameTime.TotalMilliseconds; collisionBox = new Rectangle(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), collisionBox.Width, collisionBox.Height); }