public override void Draw() { Disc.Draw(base.GetColor()); if (!_drawRadius) { return; } if (_radiusMax > 0) { ExtDrawGuizmos.DebugWireSphere(Disc.Position, Color.red, _radiusMax * transform.lossyScale.Maximum()); } }
public override void Draw(GameTime gameTime) { ScreenManager.GraphicsDevice.Clear(Color.ForestGreen); var _spriteBatch = ScreenManager.SpriteBatch; //If it isn't shaking make it the identity matrix Matrix shakeTransform = Matrix.Identity; if (is_hit_by_bush) { shakeTransform = Matrix.CreateTranslation(20 * MathF.Sin(elapsed_text_time * 1000), 20 * MathF.Cos(elapsed_text_time * 1000), 0); } // TODO: Add your drawing code here _spriteBatch.Begin(transformMatrix: shakeTransform); if (current_round_time < 1.5) { _spriteBatch.DrawString(font, "Hole 3", new Vector2(775, 500), Color.Gold); } //Draw class objects disc.Draw(_spriteBatch); foreach (Bush bush in bushes) { bush.Draw(gameTime, _spriteBatch); } foreach (Tree tree in trees) { tree.Draw(gameTime, _spriteBatch); } //Had to rotate by another 90 degrees (radians) because arrow sprite was draw straight north in the sprite (rather then where the unit circle starts) _spriteBatch.Draw(windArrow, new Vector2(1375, 64), null, Color.White, windAngle + (float)(Math.PI / 2.0), new Vector2(16, 16), 1f, SpriteEffects.None, 1); _spriteBatch.DrawString(high_score_font, "WIND", new Vector2(1325, 120), Color.Red); _spriteBatch.DrawString(high_score_font, "Hole 3", new Vector2(1820, 1040), Color.Gold); #region High Score Drawing _spriteBatch.DrawString(high_score_font, current_round_time.ToString("n3") + " seconds", new Vector2(2, 2), Color.Gold); _spriteBatch.DrawString(high_score_font, "Total Time: " + past_high_score.ToString("n3") + " seconds", new Vector2(1500, 2), Color.Gold); #endregion //Obstacle/winning logic, disables input either way and the resets player if (is_hit_by_bush) { if (elapsed_text_time < 1.5) { input_enabled = false; _spriteBatch.DrawString(font, "BONK!", new Vector2(800, 500), Color.Red); elapsed_text_time += (float)gameTime.ElapsedGameTime.TotalSeconds; GamePad.SetVibration(0, 0.5f, 0.5f); bushParticleSystem.PlaceExplosion(disc.Position); } else { elapsed_text_time = 0f; disc.Position = new Vector2(1800, 5); input_enabled = true; is_hit_by_bush = false; GamePad.SetVibration(0, 0, 0); current_round_time = 0.0f; } } if (is_in_basket) { basket.DrawWin(gameTime, _spriteBatch); if (elapsed_text_time < 1.5) { input_enabled = false; _spriteBatch.DrawString(font, "CHAINS!", new Vector2(800, 500), Color.Orange); elapsed_text_time += (float)gameTime.ElapsedGameTime.TotalSeconds; GamePad.SetVibration(0, 0.5f, 0.5f); high_score_time = current_round_time; basketParticleSystem.PlaceExplosion(new Vector2(basket.Bounds.X + basket.Bounds.Width / 2, basket.Bounds.Y + basket.Bounds.Height / 2)); } else { elapsed_text_time = 0f; disc.Position = new Vector2(1800, 5); input_enabled = true; is_in_basket = false; GamePad.SetVibration(0, 0, 0); current_round_time = 0.0f; switch_holes = true; /*//generate a new wind each time the player wins * windAngle = (float)(rand.NextDouble() * 2 * Math.PI); * windDirection = new Vector2((float)Math.Cos(windAngle), (float)Math.Sin(windAngle)); * * //Update particle enginer for new wind * windParticleSystem.Source = GetWindSourceRect(); * windParticleSystem.WindDirection = windDirection;*/ } } else { basket.Draw(_spriteBatch); //Just draw the normal basket } _spriteBatch.End(); base.Draw(gameTime); }