mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
79 lines
1.9 KiB
C#
79 lines
1.9 KiB
C#
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Maths;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
namespace Robust.Server.GameObjects
|
|
{
|
|
public class PointLightComponent : Component
|
|
{
|
|
private Color _color;
|
|
private bool _enabled;
|
|
private int _radius;
|
|
private Vector2 _offset;
|
|
|
|
public override string Name => "PointLight";
|
|
public override uint? NetID => NetIDs.POINT_LIGHT;
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public Color Color
|
|
{
|
|
get => _color;
|
|
set
|
|
{
|
|
_color = value;
|
|
Dirty();
|
|
}
|
|
}
|
|
|
|
[ViewVariables]
|
|
public bool Enabled
|
|
{
|
|
get => _enabled;
|
|
set
|
|
{
|
|
_enabled = value;
|
|
Dirty();
|
|
}
|
|
}
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public int Radius
|
|
{
|
|
get => _radius;
|
|
set
|
|
{
|
|
_radius = value;
|
|
Dirty();
|
|
}
|
|
}
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public Vector2 Offset
|
|
{
|
|
get => _offset;
|
|
set
|
|
{
|
|
_offset = value;
|
|
Dirty();
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void ExposeData(ObjectSerializer serializer)
|
|
{
|
|
base.ExposeData(serializer);
|
|
|
|
serializer.DataField(ref _enabled, "enabled", true);
|
|
serializer.DataField(ref _color, "color", new Color(200, 200, 200));
|
|
serializer.DataField(ref _radius, "radius", 512);
|
|
serializer.DataField(ref _offset, "offset", Vector2.Zero);
|
|
}
|
|
|
|
public override ComponentState GetComponentState()
|
|
{
|
|
return new PointLightComponentState(Enabled, Color, Radius, Offset);
|
|
}
|
|
}
|
|
}
|