/// <summary> /// On space switch to the Jump State /// </summary> /// <param name="source">Event Source</param> /// <param name="args">Event Arguments</param> public void OnSpace(object source, InputEvent args) { if (args.currentKey == Keybindings.Jump && Global.GameState == Global.availGameStates.Playing) { mPMind.ChangeState("jump"); mInputManager.Un_Space(OnSpace); mInputManager.Un_Move(OnMoveInput); } }
/// <summary> /// Draw Text on screen /// </summary> /// <param name="_spiteBatch">Reference to main SpriteBatch</param> /// <param name="_gameTime">Reference to current GameTime</param> public void Draw(SpriteBatch _spiteBatch, GameTime _gameTime) { // Recalculate position each draw loop mTextPos = new Vector2(Global.Camera.Position.X - 525, Global.Camera.Position.Y + 225); mArtPos = new Vector2(Global.Camera.Position.X - 725, Global.Camera.Position.Y + 225); if (mArt2 != null) { mArtPos2 = new Vector2(Global.Camera.Position.X + 475, Global.Camera.Position.Y + 225); } // Create rectangle to position the full character art mArtRect = new Rectangle(mArtPos.ToPoint(), new Point(mArt.Width, mArt.Height)); if (mArt2 != null) { mArtRect2 = new Rectangle(mArtPos2.ToPoint(), new Point(mArt2.Width, mArt2.Height)); } // While there are lines to display and the running variable is active if (mCurrLine < mLines.Length && mRunning) { // Update the internal timer mTimer += (float)_gameTime.ElapsedGameTime.TotalMilliseconds; // Pass the current line to the Dialogue Box mDialogueBox.Draw(_spiteBatch, mLines[mCurrLine], mTextPos); // Draw thefull character Art _spiteBatch.Draw(mArt, mArtRect, Color.White); if (mArt2 != null) { _spiteBatch.Draw(mArt2, mArtRect2, Color.White); } // If the timer is reached move to next line and update timer. if (mTimer >= mInterval) { mCurrLine++; mTimer = 0; } } else { // At end of dialogue reset the running bool to false; mRunning = false; // Unsubscribe from the Input Event mInputManager.Un_Space(OnSpace); mSpeaker.DialougeComplete(); } }