перенос общих файлов из папки White в _White
This commit is contained in:
74
Content.Shared/_White/Trail/SharedTrailComponent.cs
Normal file
74
Content.Shared/_White/Trail/SharedTrailComponent.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared._White.Spline;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
using Vector4 = Robust.Shared.Maths.Vector4;
|
||||
|
||||
namespace Content.Shared._White.Trail;
|
||||
|
||||
[NetworkedComponent]
|
||||
public abstract partial class SharedTrailComponent : Component, ITrailSettings
|
||||
{
|
||||
[DataField("gravity")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual Vector2 Gravity { get; set; }
|
||||
|
||||
[DataField("lifetime", required: true)]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual float Lifetime { get; set; }
|
||||
|
||||
[DataField("lengthStep")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual float LengthStep { get; set; }
|
||||
|
||||
[DataField("randomWalk")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual Vector2 MaxRandomWalk { get; set; }
|
||||
|
||||
[DataField("scale", required: true)]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual Vector2 Scale { get; set; }
|
||||
|
||||
[DataField("texturePath")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual string? TexurePath { get; set; }
|
||||
|
||||
[DataField("creationOffset")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual Vector2 CreationOffset { get; set; }
|
||||
|
||||
[DataField("сreationDistanceThresholdSquared")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual float СreationDistanceThresholdSquared { get; set; }
|
||||
|
||||
[DataField("creationMethod")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual SegmentCreationMethod СreationMethod { get; set; }
|
||||
|
||||
[DataField("gradient", required: true)]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual Vector4[] Gradient { get; set; } = new[] { Vector4.One, new Vector4(1f, 1f, 1f, 0f) };
|
||||
|
||||
[DataField("gradientIteratorType")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual Spline4DType GradientIteratorType { get; set; }
|
||||
|
||||
[DataField("splineIteratorType")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual Spline2DType SplineIteratorType { get; set; }
|
||||
|
||||
[DataField("splineRendererType")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public virtual TrailSplineRendererType SplineRendererType { get; set; }
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class TrailComponentState : ComponentState
|
||||
{
|
||||
public TrailSettings Settings;
|
||||
|
||||
public TrailComponentState(TrailSettings settings)
|
||||
{
|
||||
Settings = settings;
|
||||
}
|
||||
}
|
||||
97
Content.Shared/_White/Trail/TrailSettings.cs
Normal file
97
Content.Shared/_White/Trail/TrailSettings.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared._White.Spline;
|
||||
using Robust.Shared.Serialization;
|
||||
using Vector4 = Robust.Shared.Maths.Vector4;
|
||||
|
||||
namespace Content.Shared._White.Trail;
|
||||
|
||||
[DataDefinition]
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class TrailSettings : ITrailSettings
|
||||
{
|
||||
public static readonly TrailSettings Default = new();
|
||||
|
||||
public Vector2 Scale { get; set; } = new(0.5f, 1f);
|
||||
|
||||
public float СreationDistanceThresholdSquared { get; set; } = 0.1f;
|
||||
|
||||
public SegmentCreationMethod СreationMethod { get; set; } = SegmentCreationMethod.OnFrameUpdate;
|
||||
|
||||
public Vector2 CreationOffset { get; set; } = Vector2.Zero;
|
||||
|
||||
public Vector2 Gravity { get; set; } = new(0.01f, 0.01f);
|
||||
|
||||
public Vector2 MaxRandomWalk { get; set; } = new(0.005f, 0.005f);
|
||||
|
||||
public float Lifetime { get; set; }
|
||||
|
||||
public float LengthStep { get; set; } = 0.1f;
|
||||
|
||||
public string? TexurePath { get; set; }
|
||||
|
||||
public Vector4[] Gradient { get; set; } = { new(1f, 1f, 1f, 1f), new(1f, 1f, 1f, 0f) };
|
||||
|
||||
public Spline4DType GradientIteratorType { get; set; }
|
||||
|
||||
public Spline2DType SplineIteratorType { get; set; }
|
||||
|
||||
public TrailSplineRendererType SplineRendererType { get; set; }
|
||||
|
||||
public static void Inject(ITrailSettings into, ITrailSettings from)
|
||||
{
|
||||
into.Scale = from.Scale;
|
||||
into.СreationDistanceThresholdSquared = from.СreationDistanceThresholdSquared;
|
||||
into.СreationMethod = from.СreationMethod;
|
||||
into.CreationOffset = from.CreationOffset;
|
||||
into.Gravity = from.Gravity;
|
||||
into.MaxRandomWalk = from.MaxRandomWalk;
|
||||
into.Lifetime = from.Lifetime;
|
||||
into.LengthStep = from.LengthStep;
|
||||
into.TexurePath = from.TexurePath;
|
||||
into.Gradient = from.Gradient;
|
||||
into.SplineIteratorType = from.SplineIteratorType;
|
||||
into.SplineRendererType = from.SplineRendererType;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ITrailSettings
|
||||
{
|
||||
Vector2 Gravity { get; set; }
|
||||
|
||||
float Lifetime { get; set; }
|
||||
|
||||
float LengthStep { get; set; }
|
||||
|
||||
Vector2 MaxRandomWalk { get; set; }
|
||||
|
||||
Vector2 Scale { get; set; }
|
||||
|
||||
string? TexurePath { get; set; }
|
||||
|
||||
Vector2 CreationOffset { get; set; }
|
||||
|
||||
float СreationDistanceThresholdSquared { get; set; }
|
||||
|
||||
SegmentCreationMethod СreationMethod { get; set; }
|
||||
|
||||
Vector4[] Gradient { get; set; }
|
||||
|
||||
Spline4DType GradientIteratorType { get; set; }
|
||||
|
||||
Spline2DType SplineIteratorType { get; set; }
|
||||
|
||||
TrailSplineRendererType SplineRendererType { get; set; }
|
||||
}
|
||||
|
||||
public enum SegmentCreationMethod : byte
|
||||
{
|
||||
OnFrameUpdate,
|
||||
OnMove
|
||||
}
|
||||
|
||||
public enum TrailSplineRendererType : byte
|
||||
{
|
||||
Continuous,
|
||||
Point,
|
||||
Debug
|
||||
}
|
||||
Reference in New Issue
Block a user