Background sprites can be set to spawn on the sea floor, particle emitters can be attached to background sprites
This commit is contained in:
+28
-5
@@ -7,20 +7,32 @@ namespace Barotrauma
|
||||
{
|
||||
class BackgroundSpritePrefab
|
||||
{
|
||||
[Flags]
|
||||
public enum SpawnPosType
|
||||
{
|
||||
None = 0,
|
||||
Wall = 1,
|
||||
RuinWall = 2,
|
||||
SeaFloor = 4
|
||||
}
|
||||
|
||||
public readonly Sprite Sprite;
|
||||
|
||||
public readonly Alignment Alignment;
|
||||
|
||||
public readonly Vector2 Scale;
|
||||
|
||||
public bool SpawnOnWalls;
|
||||
public SpawnPosType SpawnPos;
|
||||
|
||||
public readonly bool AlignWithSurface;
|
||||
|
||||
|
||||
public readonly Vector2 RandomRotation;
|
||||
|
||||
public readonly Vector2 DepthRange;
|
||||
|
||||
public readonly Particles.ParticleEmitter ParticleEmitter;
|
||||
public readonly Vector2 EmitterPosition;
|
||||
|
||||
public readonly float SwingAmount;
|
||||
|
||||
public readonly int Commonness;
|
||||
@@ -37,8 +49,16 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Commonness = ToolBox.GetAttributeInt(element, "commonness", 1);
|
||||
|
||||
SpawnOnWalls = ToolBox.GetAttributeBool(element, "spawnonwalls", true);
|
||||
|
||||
string[] spawnPosStrs = ToolBox.GetAttributeString(element, "spawnpos", "Wall").Split(',');
|
||||
foreach (string spawnPosStr in spawnPosStrs)
|
||||
{
|
||||
SpawnPosType parsedSpawnPos;
|
||||
if (Enum.TryParse(spawnPosStr.Trim(), out parsedSpawnPos))
|
||||
{
|
||||
SpawnPos |= parsedSpawnPos;
|
||||
}
|
||||
}
|
||||
|
||||
Scale.X = ToolBox.GetAttributeFloat(element, "minsize", 1.0f);
|
||||
Scale.Y = ToolBox.GetAttributeFloat(element, "maxsize", 1.0f);
|
||||
@@ -69,7 +89,10 @@ namespace Barotrauma
|
||||
OverrideCommonness.Add(levelType, ToolBox.GetAttributeInt(subElement, "commonness", 1));
|
||||
}
|
||||
break;
|
||||
|
||||
case "particleemitter":
|
||||
ParticleEmitter = new Particles.ParticleEmitter(subElement);
|
||||
EmitterPosition = ToolBox.GetAttributeVector2(subElement, "position", Vector2.Zero);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user