Option to hide waypoints and spawnpoints in editor, fixed cam "twitching" in multiplayer, additional light sprites for lightcomponents, wire bugfixes, fixed excessive camera shake when firing the railgun
This commit is contained in:
@@ -8,7 +8,16 @@ namespace Barotrauma.Lights
|
||||
class LightManager
|
||||
{
|
||||
//public static Vector2 ViewPos;
|
||||
public static Entity ViewTarget;
|
||||
private static Entity viewTarget;
|
||||
|
||||
public static Entity ViewTarget
|
||||
{
|
||||
get { return viewTarget; }
|
||||
set {
|
||||
if (viewTarget == value) return;
|
||||
viewTarget = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color AmbientLight;
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace Barotrauma.Lights
|
||||
|
||||
private Texture2D texture;
|
||||
|
||||
public Sprite LightSprite;
|
||||
|
||||
public Entity Submarine;
|
||||
|
||||
//what was the range of the light when HullsInRange were last updated
|
||||
@@ -85,7 +87,7 @@ namespace Barotrauma.Lights
|
||||
this.range = range;
|
||||
this.color = color;
|
||||
|
||||
texture = lightTexture;
|
||||
texture = LightTexture;
|
||||
|
||||
GameMain.LightManager.AddLight(this);
|
||||
}
|
||||
@@ -106,6 +108,11 @@ namespace Barotrauma.Lights
|
||||
Vector2 center = new Vector2(LightTexture.Width / 2, LightTexture.Height / 2);
|
||||
float scale = range / (lightTexture.Width / 2.0f);
|
||||
spriteBatch.Draw(lightTexture, new Vector2(WorldPosition.X, -WorldPosition.Y), null, color, 0, center, scale, SpriteEffects.None, 1);
|
||||
|
||||
if (LightSprite != null)
|
||||
{
|
||||
LightSprite.Draw(spriteBatch, new Vector2(WorldPosition.X, -WorldPosition.Y), Color);
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove()
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Barotrauma
|
||||
|
||||
private Body body;
|
||||
|
||||
private Vector2 targetPosition;
|
||||
private Vector2? targetPosition;
|
||||
|
||||
float mass = 10000.0f;
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Barotrauma
|
||||
|
||||
public Vector2 TargetPosition
|
||||
{
|
||||
get { return targetPosition; }
|
||||
//get { return targetPosition; }
|
||||
set
|
||||
{
|
||||
if (!MathUtils.IsValid(value)) return;
|
||||
@@ -210,26 +210,33 @@ namespace Barotrauma
|
||||
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
if (targetPosition != Vector2.Zero && targetPosition != Position)
|
||||
if (targetPosition != null && targetPosition != Position)
|
||||
{
|
||||
float dist = Vector2.Distance(targetPosition, Position);
|
||||
Vector2 targetSimPos = ConvertUnits.ToSimUnits((Vector2)targetPosition);
|
||||
|
||||
float dist = Vector2.Distance((Vector2)targetPosition, Position);
|
||||
if (dist > 1000.0f)
|
||||
{
|
||||
body.SetTransform(ConvertUnits.ToSimUnits(targetPosition), 0.0f);
|
||||
targetPosition = Vector2.Zero;
|
||||
body.SetTransform(targetSimPos, 0.0f);
|
||||
targetPosition = null;
|
||||
}
|
||||
else if (dist > 50.0f)
|
||||
{
|
||||
body.SetTransform((ConvertUnits.ToSimUnits(targetPosition) - body.Position) * 0.01f, 0.0f);
|
||||
Vector2 moveAmount = Vector2.Normalize(targetSimPos - body.Position);
|
||||
moveAmount *= Math.Min(dist, 100.0f);
|
||||
|
||||
body.SetTransform(body.Position + moveAmount * deltaTime, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPosition = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPosition = Vector2.Zero;
|
||||
targetPosition = null;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------
|
||||
|
||||
Vector2 totalForce = CalculateBuoyancy();
|
||||
|
||||
@@ -15,6 +15,8 @@ namespace Barotrauma
|
||||
{
|
||||
public static List<WayPoint> WayPointList = new List<WayPoint>();
|
||||
|
||||
public static bool ShowWayPoints, ShowSpawnPoints;
|
||||
|
||||
private SpawnType spawnType;
|
||||
|
||||
//characters spawning at the waypoint will be given an ID card with these tags
|
||||
@@ -84,6 +86,15 @@ namespace Barotrauma
|
||||
{
|
||||
if (!editing && !GameMain.DebugDraw) return;
|
||||
|
||||
if (spawnType == SpawnType.Path)
|
||||
{
|
||||
if (!GameMain.DebugDraw && !ShowWayPoints) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!GameMain.DebugDraw && !ShowSpawnPoints) return;
|
||||
}
|
||||
|
||||
Rectangle drawRect =
|
||||
Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
|
||||
|
||||
@@ -96,7 +107,7 @@ namespace Barotrauma
|
||||
foreach (MapEntity e in linkedTo)
|
||||
{
|
||||
GUI.DrawLine(spriteBatch,
|
||||
new Vector2(drawRect.X, -drawRect.Y),
|
||||
new Vector2(drawRect.X+rect.Width/2.0f, -drawRect.Y+rect.Height/2.0f),
|
||||
new Vector2(e.DrawPosition.X, -e.DrawPosition.Y),
|
||||
Color.Green);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user