Lighting fixes & teleporting characters to sub

This commit is contained in:
Regalis11
2015-12-06 16:07:25 +02:00
parent 09588e548d
commit 40fb8d803d
11 changed files with 66 additions and 27 deletions
+14 -5
View File
@@ -144,8 +144,8 @@ namespace Barotrauma.Items.Components
Vector2[] corners = GetConvexHullCorners(doorRect);
convexHull = new ConvexHull(corners, Color.Black);
if (window!=Rectangle.Empty) convexHull2 = new ConvexHull(corners, Color.Black);
convexHull = new ConvexHull(corners, Color.Black, item.CurrentHull == null ? null : item.CurrentHull.Submarine);
if (window!=Rectangle.Empty) convexHull2 = new ConvexHull(corners, Color.Black, item.CurrentHull == null ? null : item.CurrentHull.Submarine);
UpdateConvexHulls();
@@ -303,7 +303,12 @@ namespace Barotrauma.Items.Components
if (stuck>0.0f && weldedSprite!=null)
{
weldedSprite.Draw(spriteBatch, new Vector2(item.Rect.X, -item.Rect.Y), Color.White*(stuck/100.0f), 0.0f, 1.0f);
Vector2 weldSpritePos = new Vector2(item.Rect.X, item.Rect.Y);
if (item.Submarine != null) weldSpritePos += item.Submarine.Position;
weldSpritePos.Y = -weldSpritePos.Y;
weldedSprite.Draw(spriteBatch,
weldSpritePos, Color.White*(stuck/100.0f), 0.0f, 1.0f);
}
if (openState == 1.0f)
@@ -311,8 +316,12 @@ namespace Barotrauma.Items.Components
body.Enabled = false;
return;
}
spriteBatch.Draw(doorSprite.Texture, new Vector2(item.Rect.Center.X, -item.Rect.Y),
Vector2 pos = new Vector2(item.Rect.Center.X, -item.Rect.Y);
if (item.Submarine != null) pos += item.Submarine.Position;
pos.Y = -pos.Y;
spriteBatch.Draw(doorSprite.Texture, pos,
new Rectangle(doorSprite.SourceRect.X, (int)(doorSprite.size.Y * openState),
(int)doorSprite.size.X, (int)(doorSprite.size.Y * (1.0f - openState))),
color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth);
@@ -88,7 +88,7 @@ namespace Barotrauma.Items.Components
// break;
//}
light = new LightSource(item.Position, 100.0f, Color.White);
light = new LightSource(item.Position, 100.0f, Color.White, item.CurrentHull == null ? null : item.CurrentHull.Submarine);
IsActive = true;