Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaShared/Source/Characters/DelayedEffect.cs
T
Joonas Rikkonen 8e556f1c76 - Renamed a bunch of ObjectProperty-related stuff (ObjectProperty -> SerializableProperty, IPropertyObject -> ISerializableEntity, the "SerializableProperty" attribute -> Serialize).
- Rectangle serialization.
- Option to restrict numeric properties to a range of values.
- WIP generic ISerializableEntity editor.
2017-11-08 21:15:03 +02:00

53 lines
1.1 KiB
C#

using System.Collections.Generic;
using System.Xml.Linq;
namespace Barotrauma
{
class DelayedEffect : StatusEffect
{
public static List<DelayedEffect> List = new List<DelayedEffect>();
private float delay;
private float startTimer;
private Entity entity;
private List<ISerializableEntity> targets;
public float StartTimer
{
get { return startTimer; }
}
public DelayedEffect(XElement element)
: base(element)
{
delay = element.GetAttributeFloat("delay", 1.0f);
}
public override void Apply(ActionType type, float deltaTime, Entity entity, List<ISerializableEntity> targets)
{
if (this.type != type) return;
startTimer = delay;
this.entity = entity;
this.targets = targets;
List.Add(this);
}
public void Update(float deltaTime)
{
startTimer -= deltaTime;
if (startTimer > 0.0f) return;
base.Apply(1.0f, entity, targets);
List.Remove(this);
}
}
}