Removing the obstruction element without flickering, better looking (& working) radar

This commit is contained in:
Regalis
2015-11-01 22:10:31 +02:00
parent 73bde75c2e
commit e4a048a54a
13 changed files with 167 additions and 57 deletions

View File

@@ -890,6 +890,19 @@ namespace Barotrauma
}
}
for (int side = 0; side < 2; side++)
{
for (int n = 0; n < 2; n++)
{
if (Vector2.Distance(wrappingWalls[side, n].MidPos, pos) > WrappingWall.WallWidth) continue;
foreach (VoronoiCell cell in wrappingWalls[side, n].Cells)
{
cells.Add(cell);
}
}
}
return cells;
}
@@ -921,7 +934,7 @@ namespace Barotrauma
Vector2 end = cell.edges[i].point2 + Position;
end.Y = -end.Y;
edges.Add(new Vector2[] { start, end });
//GUI.DrawLine(spriteBatch, start, end, (cell.body != null && cell.body.Enabled) ? Color.Green : Color.Red);
}

View File

@@ -79,6 +79,8 @@ namespace Barotrauma.Lights
spriteBatch.Begin(SpriteSortMode.Immediate, CustomBlendStates.Multiplicative);
spriteBatch.Draw(losTexture, Vector2.Zero);
spriteBatch.End();
ObstructVision = false;
}
public void OnMapLoaded()
@@ -164,8 +166,8 @@ namespace Barotrauma.Lights
Vector2 diff = lookAtPosition - ViewPos;
diff.Y = -diff.Y;
float rotation = MathUtils.VectorToAngle(diff);
Vector2 scale = new Vector2(3.0f, 1.0f);
Vector2 scale = new Vector2(MathHelper.Clamp(diff.Length()/256.0f, 2.0f, 5.0f), 2.0f);
spriteBatch.Draw(LightSource.LightTexture, new Vector2(ViewPos.X, -ViewPos.Y), null, Color.White, rotation,
new Vector2(LightSource.LightTexture.Width*0.2f, LightSource.LightTexture.Height/2), scale, SpriteEffects.None, 0.0f);