Carp wave spawner and dragons as an actual event (#10254)
This commit is contained in:
51
Content.Client/Dragon/DragonSystem.cs
Normal file
51
Content.Client/Dragon/DragonSystem.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Content.Shared.Dragon;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Client.Dragon;
|
||||
|
||||
public sealed class DragonSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<DragonRiftComponent, ComponentHandleState>(OnRiftHandleState);
|
||||
}
|
||||
|
||||
private void OnRiftHandleState(EntityUid uid, DragonRiftComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not DragonRiftComponentState state)
|
||||
return;
|
||||
|
||||
if (component.State == state.State) return;
|
||||
|
||||
component.State = state.State;
|
||||
TryComp<SpriteComponent>(uid, out var sprite);
|
||||
TryComp<PointLightComponent>(uid, out var light);
|
||||
|
||||
if (sprite == null && light == null)
|
||||
return;
|
||||
|
||||
switch (state.State)
|
||||
{
|
||||
case DragonRiftState.Charging:
|
||||
sprite?.LayerSetColor(0, Color.FromHex("#569fff"));
|
||||
|
||||
if (light != null)
|
||||
light.Color = Color.FromHex("#366db5");
|
||||
break;
|
||||
case DragonRiftState.AlmostFinished:
|
||||
sprite?.LayerSetColor(0, Color.FromHex("#cf4cff"));
|
||||
|
||||
if (light != null)
|
||||
light.Color = Color.FromHex("#9e2fc1");
|
||||
break;
|
||||
case DragonRiftState.Finished:
|
||||
sprite?.LayerSetColor(0, Color.FromHex("#edbc36"));
|
||||
|
||||
if (light != null)
|
||||
light.Color = Color.FromHex("#cbaf20");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user