using System;
namespace Otter {
///
/// Rectangle Collider.
///
public class BoxCollider : Collider {
#region Constructors
///
/// Creates a new box collider.
///
/// The width of the collider.
/// The height of the collider.
/// Any tags the collider should have.
public BoxCollider(int width, int height, params int[] tags) {
Width = width;
Height = height;
AddTag(tags);
}
public BoxCollider(int width, int height, Enum tag, params Enum[] tags) : this(width, height) {
AddTag(tag);
AddTag(tags);
}
#endregion
#region Public Methods
///
/// Draw the collider for debug purposes.
///
public override void Render(Color color = null) {
base.Render(color);
if (color == null) color = Color.Red;
if (Entity == null) return;
if (Width <= 2 || Height <= 2) {
Draw.Rectangle(Left, Top, Width, Height, color);
}
else {
Draw.Rectangle(Left + 1, Top + 1, Width - 2, Height - 2, Color.None, color, 1f);
}
}
#endregion
}
}