2020-12-22 03:13:43 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
using MessagePack;
|
|
|
|
|
using Newtonsoft.Json;
|
2026-09-14 17:39:12 +02:00
|
|
|
using CultMath;
|
|
|
|
|
using static CultMath.math;
|
2026-08-10 14:57:50 +01:00
|
|
|
|
|
|
|
|
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
|
|
|
|
public class ReflectorData : BehaviorData
|
|
|
|
|
{
|
|
|
|
|
[Inspectable, JsonProperty("crossSection"), Key(1), RuntimeInspectable]
|
|
|
|
|
public PerformanceStat CrossSection = new PerformanceStat();
|
|
|
|
|
|
|
|
|
|
// [InspectableAnimationCurve, JsonProperty("visibility"), Key(1)]
|
|
|
|
|
// public float4[] VisibilityCurve;
|
|
|
|
|
|
|
|
|
|
public override Behavior CreateInstance(EquippedItem item)
|
|
|
|
|
{
|
|
|
|
|
return new Reflector(this, item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Behavior CreateInstance(ConsumableItemEffect item)
|
|
|
|
|
{
|
|
|
|
|
return new Reflector(this, item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-18 05:13:20 +01:00
|
|
|
public class Reflector : Behavior
|
2020-04-09 10:33:16 +01:00
|
|
|
{
|
2026-08-10 14:57:50 +01:00
|
|
|
private ReflectorData _data;
|
2020-04-09 10:33:16 +01:00
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
public Reflector(ReflectorData data, EquippedItem item) : base(data, item)
|
2021-04-18 05:13:20 +01:00
|
|
|
{
|
2026-08-10 14:57:50 +01:00
|
|
|
_data = data;
|
2021-04-18 05:13:20 +01:00
|
|
|
}
|
|
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
public Reflector(ReflectorData data, ConsumableItemEffect item) : base(data, item)
|
2020-04-09 10:33:16 +01:00
|
|
|
{
|
2026-08-10 14:57:50 +01:00
|
|
|
_data = data;
|
2020-04-09 10:33:16 +01:00
|
|
|
}
|
|
|
|
|
|
2021-04-18 05:13:20 +01:00
|
|
|
public override bool Execute(float dt)
|
2020-05-11 01:17:10 +01:00
|
|
|
{
|
2026-10-11 09:13:24 +02:00
|
|
|
Entity.SetSignature(this, SignatureChannel.Reflection, Evaluate(_data.CrossSection) * Entity.Zone.GetLight(Entity.Position.xz), Item);
|
2026-08-10 14:57:50 +01:00
|
|
|
|
2020-05-11 01:17:10 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
2026-08-10 14:57:50 +01:00
|
|
|
}
|