Unstable v0.1300.0.0 (February 19th 2021)
This commit is contained in:
@@ -3,9 +3,11 @@ using Barotrauma.Networking;
|
||||
using Barotrauma.Particles;
|
||||
using Barotrauma.Sounds;
|
||||
using Barotrauma.SpriteDeformations;
|
||||
using FarseerPhysics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -72,6 +74,18 @@ namespace Barotrauma
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool VisibleOnSonar
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public float SonarRadius
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
partial void InitProjSpecific()
|
||||
{
|
||||
Sprite?.EnsureLazyLoaded();
|
||||
@@ -135,6 +149,13 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VisibleOnSonar = Prefab.SonarDisruption > 0.0f || Prefab.OverrideProperties.Any(p => p != null && p.SonarDisruption > 0.0f) ||
|
||||
(Triggers != null && Triggers.Any(t => !MathUtils.NearlyEqual(t.Force, Vector2.Zero) && t.ForceMode != LevelTrigger.TriggerForceMode.LimitVelocity || !string.IsNullOrWhiteSpace(t.InfectIdentifier)));
|
||||
if (VisibleOnSonar && Triggers.Any())
|
||||
{
|
||||
SonarRadius = Triggers.Select(t => t.ColliderRadius * 1.5f).Max();
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(float deltaTime)
|
||||
@@ -220,6 +241,7 @@ namespace Barotrauma
|
||||
|
||||
private void UpdateDeformations(float deltaTime)
|
||||
{
|
||||
if (ActivePrefab.DeformableSprite == null) { return; }
|
||||
foreach (SpriteDeformation deformation in spriteDeformations)
|
||||
{
|
||||
if (deformation is PositionalDeformation positionalDeformation)
|
||||
|
||||
+35
-4
@@ -10,6 +10,7 @@ namespace Barotrauma
|
||||
partial class LevelObjectManager
|
||||
{
|
||||
private readonly List<LevelObject> visibleObjectsBack = new List<LevelObject>();
|
||||
private readonly List<LevelObject> visibleObjectsMid = new List<LevelObject>();
|
||||
private readonly List<LevelObject> visibleObjectsFront = new List<LevelObject>();
|
||||
|
||||
private double NextRefreshTime;
|
||||
@@ -26,6 +27,10 @@ namespace Barotrauma
|
||||
{
|
||||
obj.Update(deltaTime);
|
||||
}
|
||||
foreach (LevelObject obj in visibleObjectsMid)
|
||||
{
|
||||
obj.Update(deltaTime);
|
||||
}
|
||||
foreach (LevelObject obj in visibleObjectsFront)
|
||||
{
|
||||
obj.Update(deltaTime);
|
||||
@@ -34,7 +39,7 @@ namespace Barotrauma
|
||||
|
||||
public IEnumerable<LevelObject> GetVisibleObjects()
|
||||
{
|
||||
return visibleObjectsBack.Union(visibleObjectsFront);
|
||||
return visibleObjectsBack.Union(visibleObjectsMid).Union(visibleObjectsFront);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -43,6 +48,7 @@ namespace Barotrauma
|
||||
private void RefreshVisibleObjects(Rectangle currentIndices, float zoom)
|
||||
{
|
||||
visibleObjectsBack.Clear();
|
||||
visibleObjectsMid.Clear();
|
||||
visibleObjectsFront.Clear();
|
||||
|
||||
float minSizeToDraw = MathHelper.Lerp(10.0f, 5.0f, Math.Min(zoom * 20.0f, 1.0f));
|
||||
@@ -70,7 +76,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var objectList = obj.Position.Z >= 0 ? visibleObjectsBack : visibleObjectsFront;
|
||||
var objectList =
|
||||
obj.Position.Z >= 0 ?
|
||||
visibleObjectsBack :
|
||||
(obj.Position.Z < -1 ? visibleObjectsFront : visibleObjectsMid);
|
||||
int drawOrderIndex = 0;
|
||||
for (int i = 0; i < objectList.Count; i++)
|
||||
{
|
||||
@@ -102,8 +111,31 @@ namespace Barotrauma
|
||||
currentGridIndices = currentIndices;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the objects behind the level walls
|
||||
/// </summary>
|
||||
public void DrawObjectsBack(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
DrawObjects(spriteBatch, cam, visibleObjectsBack);
|
||||
}
|
||||
|
||||
public void DrawObjects(SpriteBatch spriteBatch, Camera cam, bool drawFront)
|
||||
/// <summary>
|
||||
/// Draw the objects in front of the level walls, but behind characters
|
||||
/// </summary>
|
||||
public void DrawObjectsMid(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
DrawObjects(spriteBatch, cam, visibleObjectsMid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the objects in front of the level walls and characters
|
||||
/// </summary>
|
||||
public void DrawObjectsFront(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
DrawObjects(spriteBatch, cam, visibleObjectsFront);
|
||||
}
|
||||
|
||||
private void DrawObjects(SpriteBatch spriteBatch, Camera cam, List<LevelObject> objectList)
|
||||
{
|
||||
Rectangle indices = Rectangle.Empty;
|
||||
indices.X = (int)Math.Floor(cam.WorldView.X / (float)GridSize);
|
||||
@@ -132,7 +164,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var objectList = drawFront ? visibleObjectsFront : visibleObjectsBack;
|
||||
foreach (LevelObject obj in objectList)
|
||||
{
|
||||
Vector2 camDiff = new Vector2(obj.Position.X, obj.Position.Y) - cam.WorldViewCenter;
|
||||
|
||||
Reference in New Issue
Block a user