/// <summary> /// Clamps <see cref="Zoom"/> between <see cref="MaximumZoom"/> and <see cref="MinimumZoom"/> based on the passed value. /// </summary> /// <param name="value"><see cref="Zoom"/> value to be tested. If the value is legal, <see cref="Zoom"/> will be set with the given value, otherwise <see cref="Zoom"/> will be clamped to between <see cref="MaximumZoom"/> or <see cref="MinimumZoom"/>.</param> private void ClampZoom(float value) { _zoom = MathHelper.Max( MathHelper.Min( value, MaximumZoom ), MinimumZoom ); }
/// <summary> /// Generates a <see cref="Microsoft.Xna.Framework.BoundingBox"/> for a <see cref="Komodo.Core.ECS.Components.RigidBodyComponent"/> with an attached <see cref="Komodo.Core.Physics.Box"/>. /// </summary> /// <param name="body">Body to create a <see cref="Microsoft.Xna.Framework.BoundingBox"/> for.</param> /// <returns><see cref="Microsoft.Xna.Framework.BoundingBox"/> representation of the <see cref="Komodo.Core.Physics.Box"/>.</returns> private static BoundingBox GenerateBoundingBox(RigidBodyComponent body) { var box = body.Shape as Box; var max = new Vector3( MathHelper.Max(-box.Width / 2f, box.Width / 2f), MathHelper.Max(-box.Height / 2f, box.Height / 2f), MathHelper.Max(-box.Depth / 2f, box.Depth / 2f) ) + body.WorldPosition; var min = new Vector3( MathHelper.Min(-box.Width / 2f, box.Width / 2f), MathHelper.Min(-box.Height / 2f, box.Height / 2f), MathHelper.Min(-box.Depth / 2f, box.Depth / 2f) ) + body.WorldPosition; return(new BoundingBox(min.MonoGameVector, max.MonoGameVector)); }