The size of the docked subs is taken into account when generating the level

This commit is contained in:
Regalis
2016-12-13 23:21:47 +02:00
parent 2ef7c2f996
commit a2f19a3b16
2 changed files with 30 additions and 2 deletions
+24
View File
@@ -288,6 +288,30 @@ namespace Barotrauma
tags &= ~tag;
}
/// <summary>
/// Returns a rect that contains the borders of this sub and all subs docked to it
/// </summary>
public Rectangle GetDockedBorders()
{
Rectangle dockedBorders = Borders;
dockedBorders.Y -= dockedBorders.Height;
foreach (Submarine dockedSub in DockedTo)
{
Vector2 diff = dockedSub.Submarine == this ? dockedSub.WorldPosition : dockedSub.WorldPosition - WorldPosition;
Rectangle dockedSubBorders = dockedSub.Borders;
dockedSubBorders.Y -= dockedSubBorders.Height;
dockedSubBorders.Location += diff.ToPoint();
dockedBorders = Rectangle.Union(dockedBorders, dockedSubBorders);
}
dockedBorders.Y += dockedBorders.Height;
return dockedBorders;
}
//drawing ----------------------------------------------------
public static void CullEntities(Camera cam)