FilledRectTests CheckCollisionOnAllSidesWithRotatedRectangles Method Delta Engine Documentation

Namespace: DeltaEngine.Rendering2D.Shapes.Tests
Assembly: DeltaEngine.Rendering2D.Shapes.Tests (in DeltaEngine.Rendering2D.Shapes.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void CheckCollisionOnAllSidesWithRotatedRectangles()
Examples

[Test, ApproveFirstFrameScreenshot]
public void CheckCollisionOnAllSidesWithRotatedRectangles()
{
    var rect = new FilledRect(new Rectangle(0.4f, 0.4f, 0.2f, 0.2f), Color.White);
    var top = new FilledRect(new Rectangle(0.4f, 0.2f, 0.2f, 0.2f), Color.Yellow)
    {
        Rotation = 45
    };
    var left = new FilledRect(new Rectangle(0.2f, 0.4f, 0.2f, 0.2f), Color.Blue)
    {
        Rotation = 135
    };
    var bottom = new FilledRect(new Rectangle(0.4f, 0.6f, 0.2f, 0.2f), Color.Green)
    {
        Rotation = 225
    };
    var right = new FilledRect(new Rectangle(0.6f, 0.4f, 0.2f, 0.2f), Color.Red)
    {
        Rotation = 315
    };
    Assert.IsTrue(rect.DrawArea.IsColliding(0, top.DrawArea, top.Rotation));
    Assert.IsTrue(rect.DrawArea.IsColliding(0, left.DrawArea, left.Rotation));
    Assert.IsTrue(rect.DrawArea.IsColliding(0, bottom.DrawArea, bottom.Rotation));
    Assert.IsTrue(rect.DrawArea.IsColliding(0, right.DrawArea, right.Rotation));
}
See Also